Question
Ussing JAVA write a recursive method called subsets to find every possible sub-list of given list. a sub list of a list z contains 0
Ussing JAVA
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
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