Question: In java please!! compelete the method given Using recursion generate every way for an array to be split up into a sequence that are nonempty
In java please!! compelete the method given
Using recursion generate every way for an array to be split up into a sequence that are nonempty sublists. An example would be, given the array [2, 5, 3, 8], return the following lists of lists: [[2], [5], [3], [8]], [[2, 5], [3], [8]], [[2], [5, 3], [8]], [[2, 5, 3], [8]], [[2], [5], [3, 8]], [[2, 5], [3, 8]], [[2], [5, 3, 8]], [[2, 5, 3, 8]]
Heres a hint: Generate all the sublists of the list with the last element removed. The very last element can be a subsequence of length 1, or it can be added to the last subsequence.
public static String subArrayGen(int[] givenSequence) { }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
