Question
I have to create a string of all the sub-arrays of a given int array, not including the empty array, in Java such as that
I have to create a string of all the sub-arrays of a given int array, not including the empty array, in Java such as that being given {1,2} will print [[1],[2],[1,2]].
This has to be done using recursion and I don't think recursively. The only hint given by the teacher was "First generate all sublists of the list with the last element removed. The last element can either be a subsequence of length 1, or it can be added to the last subsequence." I'm not asking for the whole code, though a very basic skeleton explaining what needs to be done would be nice, I would just like to be put in the right direction with some help.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started