2021-11-08 16:56:22 +01:00
|
|
|
# heap-algorithm
|
|
|
|
|
2023-07-02 17:28:54 +02:00
|
|
|
Created by [@theoludwig](https://github.com/theoludwig) on 8 November 2021.
|
2021-11-08 16:56:22 +01:00
|
|
|
|
|
|
|
## Instructions
|
|
|
|
|
|
|
|
Write a program that generates all possible unique permutations of a string.
|
|
|
|
|
2023-08-21 21:37:54 +02:00
|
|
|
The order of the generated permutations is important, see the example below.
|
|
|
|
|
2021-11-08 16:56:22 +01:00
|
|
|
## Source
|
|
|
|
|
|
|
|
- [Heap's Algorithm - Wikipedia](https://en.wikipedia.org/wiki/Heap%27s_algorithm)
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
### Example 1
|
|
|
|
|
|
|
|
#### Input
|
|
|
|
|
|
|
|
```txt
|
|
|
|
abc
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Output
|
|
|
|
|
|
|
|
```txt
|
|
|
|
abc
|
|
|
|
bac
|
|
|
|
cab
|
|
|
|
acb
|
2023-08-21 21:37:54 +02:00
|
|
|
bca
|
|
|
|
cba
|
2021-11-08 16:56:22 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
See the `test` folder for examples of input/output.
|