I need some help on the following java program:
Write a recursive method that has two parameters, first and second, that are both strings. The method should print all rearrangements of the letters in first followed by second. For example, if first is the string "CAT" and second is the string "MAN", then the method would print the strings CATMAN, CTAMAN, ACTMAN, TACMAN, and TCAMAN. The stopping case of the method occurs when the length of first has zero characters. We'll leave the recursive thinking up to you. It also give tips to use the substring method for strings.
It's just one of those basic problems where I feel I'm not thinking abstractly enough. So far I'm just stuck at:
So any help?
Write a recursive method that has two parameters, first and second, that are both strings. The method should print all rearrangements of the letters in first followed by second. For example, if first is the string "CAT" and second is the string "MAN", then the method would print the strings CATMAN, CTAMAN, ACTMAN, TACMAN, and TCAMAN. The stopping case of the method occurs when the length of first has zero characters. We'll leave the recursive thinking up to you. It also give tips to use the substring method for strings.
It's just one of those basic problems where I feel I'm not thinking abstractly enough. So far I'm just stuck at:
PHP:
public static void sortStr(String first, String second) {
//?????????????????????????????????????????
}
Last edited: