Reference no: EM132158963
(use recursive algorithm of C )
A permutation of a set is a list of all possible arrangements of items in the set where the order is important.
For example, the permutation of the set {a b c} is (a b c), (a c b), (b a c), (b c a), (c a b), (c b a). A set with n elements has n! permutations.
Write a recursive program that prompts a user to enter words until the word GO is entered. Then print all permutations of those words.
For example:
Enter a word: many
Enter a word: dogs
Enter a word: jump
Enter a word: GO
many dogs jump
many jump dogs ....
Hint: Here is an example of a recursive algorithm for computing permutations of the set {a b c d}.
Print a, followed by all permutations of {b c d}
Print b, followed by all permutations of {a c d}
Print c, followed by all permutations of {a b d}
Print d, followed by all permutations of {a b c}