Permutations of Strings

  • + 1 comment

    So here is the logic in plain English:

    1. Find the rightmost string that is lexographically smaller than its next string. If none is found, then there is no next permutation.
    2. Find the rightmost string that is lexographically smaller than the string from Step 1.
    3. Swap with each other the strings from Step 1 and Step 2.
    4. Reverse the order of all strings that come after the original position of the string from Step 1.