Print all Permutations of A String
Sun Feb 06 2022 22:26:48 GMT+0000 (Coordinated Universal Time)
Saved by @Uttam #java #gfg #geeksforgeeks #lecture #recursion #stringpermutations
Algorithm Paradigm: Backtracking Time Complexity: O(n*n!) Note that there are n! permutations and it requires O(n) time to print a permutation. Auxiliary Space: O(r – l) Note: The above solution prints duplicate permutations if there are repeating characters in the input string. Examples : Input : s = "ABC" Output : ABC ACB BAC BCA CBA CAB Input : s = "ABC" Output : AB BA Input : s = " " Output : // Nothing to be printed
https://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
Comments