Question: write a recursive method called subsets to find every possible sub-list of given list. a sub list of a list z contains 0 or more

write a recursive method called subsets to find every possible sub-list of given list. a sub list of a list z contains 0 or more of l`s elements. your method should accept a list of strings as its parameter and print every sub list that could be created from elements of that list. one per line. for example if the list stores [Janet, Robert, Morgan, char] the out put would be:

[Janet, Robert, Morgan, char] , [Janet, Robert, Morgan, ], [Janet, Robert, char], [Janet, Robert], [Janet, Morgan, char], [Janet, Morgan], [Janet, char]

[Janet], [ Robert, Morgan, char], [Robert, Morgan], [Robert, char], [Robert], [Morgan, char],[ Morgan],[ char],[]

the order in which you show the sub list does not matter. and the order of the elements of each sub-list also does not matter. the key is that your method should produce the correct overall set of sub-list as its output. notice that empty list is considered one of these sublist. you may assume that the list is passed to your method is not null and the list contains no duplicates. do not use loops. USING JAVA

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 Databases Questions!