In this c programming tutorial we are going to see a c program to print all permutations of a given string. Now let’s see what is a permutation.

A permutation, also called an arrangement number or order, is a rearrangement of the elements of an ordered list S into a one-to-one correspondence with S itself. A string of length n has n! permutation. Source: Mathword

 

Below are the permutations of string CBA.
ABC, ACB, BAC, BCA, CAB, CBA

Algorithm Paradigm: Backtracking

Time Complexity: O(n*n!)

Please write comments if you find the above codes/algorithms incorrect, or find other ways to solve the same problem.

 Output :

all permutation of string

Tag

Related Post

Leave a Reply