This post is completed by 2 users

  • 0
Add to List

Print All The Permutations Of a String

Objective: Given a String, print all the permutations of it.

Input: A String

Output: Print all the permutations of a string


Input : abc
Output: abc acb bac bca cba cab


  1. Take one character at a time and fix it at the first position. (use swap to put every character at the first position)
  2. make recursive call to rest of the characters.
  3. use swap to revert the string back to its original form fo next iteration.


abc acb bac bca cba cab

Also Read: