# Johnson Trotter Algorithm

This program computes all permutations of a lexicographically sorted string using the Johnson and Trotter algorithm.

It is assumed that the string input is already sorted lexiographically.

Inputs: String, “n” number of permutations that the user wishes to compute of the given string.

Output: n number of permutations

ex.

Input: “abcdef”, 10

Output:

```
abcdef
abcdfe
abcfde
abfcde
afbcde
fabcde
fabced
afbced
abfced
abcfed
```

Compile using “g++ johnsonTrotterMain.cpp” or “g++ -std=c++14 johnsonTrotterMain.cpp”