Question: Exercise 3. Write a recursive method, ss (int n), to create a list formed by all the subsets of the set formed by the integer
Exercise 3. Write a recursive method, ss (int n), to create a list formed by all the subsets of the set formed by the integer values 1..n for given n>-0. For example, ss (3) will generate the list whose elements represent (not necessarily in this order): ,2, 3, ,2, , 3, 2, 3, and2, 3. Think recursively: if n-0, then the only element in that list would be If n>e, let s be the list of sets produced by ss (n-1). For each element xin s, create a new set formed by xU (n, and add that new set to list s. For example, for the above example, ss(2)-(2,,2) If we add to that list all the new sets that are This is not the best possible solution, but good enough for the purpose of this exercise. REPASO DATA STRUCTURES EXAMEN2 formed when adding elem
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
