Question: java Integer listSize is read from input, then listSize strings are read from input and stored in ArrayList namesToPick. The recursive method listNames ( )

java Integer listSize is read from input, then listSize strings are read from input and stored in ArrayList namesToPick. The recursive method listNames() explores all possible arrangements of two names picked from namesToPick. In listNames(), write the base case to output the following items if the size of ArrayList pickedNames is 2:
"1st: "
first element in pickedNames
",2nd: "
second element in pickedNames
End with a newline.
Click here for example
Ex: If the input is:
3
Bob Huy Kim
then the output is:
All possible arrangements:
1st: Bob, 2nd: Huy
1st: Bob, 2nd: Kim
1st: Huy, 2nd: Bob
1st: Huy, 2nd: Kim
1st: Kim, 2nd: Bob
1st: Kim, 2nd: Huy

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!