Write a recursive method to return all possible k permutations of the given String non-zeros number
Sample input : "123" , 2
output : "1-2", "1-3", "2-3", "2-1", "3-1", "3-2"
** Please provide
-PSEUDO CODE
-UML DIAGRAM
Sol.
Here is recursive algorithm puesdo code for permutation the
string.
permutation(string s)
if string is empty then return
for i=0 to str.length()
store char in variable a from index
i from string s
string p = str.substring(0 to i) +
str.substring(i+1)
string x;
call the recursive fuction
permutation(p, x+a)
return x to main fuction
Get Answers For Free
Most questions answered within 1 hours.