Write a recursive method to print all the permutations of a string. For example,
ID: 3641746 • Letter: W
Question
Write a recursive method to print all the permutations of a string. For example, for a string abc, the printout is:abc
acb
bac
bca
cab
cba
Hint: Define the following two methods. The second is a helper method.
public static void display Permutation (string s)
public static void display Permutation (sting s1, string s2)
The first method simply invokes Permutation (" ",s). The second method uses a loop to move a character from s2 to s1 and recursively invoke it with a new s1 and s2. The base case is that s2 is empty and prints s1 to console.