Visit www.myprogramminglab.com to complete select exercises online and get instant feedback.
Exercise
Given the definition of a 2D array such as the following,
String[ ][ ] data = {{"A", "B"},{"1", "2"},{"XX","YY","ZZ"}};
write a recursive program that outputs all combinations of each subarray in order. In the previous example, the desired output (although it does not have to be in this order) is
A 1 XXA 1 YYA 1 ZZA 2 XXA 2 YYA 2 ZZB 1 XXB 1 YYB 1 ZZB 2 XXB 2 YYB 2 ZZ
Your program should work with arbitrarily sized arrays in either dimension. For example, the following data
String[][] data = {{"A"},{"1"},{"2"},{"XX","YY"}};
should output:
A 1 2 YYA 1 2 YY
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.