Permutation of a String Duplicate

Permutation of a String Duplicate

All permutation of a string that has duplicate characters and lexicographic order.
Algorithm:
  1. If level is equal to size string then
    1. add character array to permutation list
    2. return
  2. Iterate character count map
    1. If count of character is greater than zero then
      1. add character to character array
      2. decrease character count
      3. recursively call with level + 1
      4. reset character count

Latest Source Code:
Github: PermutationOfStringWithDuplicate.java


Output:

 Permutations of "CAAB": [AABC, AACB, ABAC, ABCA, ACAB, ACBA, BAAC, BACA, BCAA, CAAB, CABA, CBAA]

Video

Author: Hrishikesh Mishra