Question: Write a recursive method called sub - list of a given list. A sub - list of a list of s elements. Your method should
Write a recursive method called
sublist of a given list. A sublist of a list
of s elements. Your method should accept a list of strings as its parameter and print every sublist that could be created from elements of that list, one per line. For example, if the list stores the output from your
method would be:
is nonnegative. If
to find every possible
contains or more
subsets
Janet Robert, Morgan, Char
nn
L
n
n
L
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
The order in which you show the sublists does not matter, and the order of the elements of each sublist also does not matter. The key thing is that your method should produce the correct overall set of sublists as its output. Notice that the empty list is considered one of these sublists. You may assume that the list passed to your method is not null and that the list contains no duplicates. Do not use any loops.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
