Skip to main content

Print all permutations of a string

The problem of printing all the permutations of a string is one of the well-known problem of backtracking. Permutation is process to find all combinations in given string characters. For example.

Input : "ABC"

Output : ABC

Using of factorial(n) we can find the number of permutations of string here n indicates number of characters in string. In above example length of text is 3 so (3 * 2) = 6.

We can write an efficient algorithm which are takes O(!n) time to printing all the permutable result. Here given code implementation process by using recursion.


Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment