Question: I need help writing this function that requires only one recursive call. Problem 7. Power Set. Given a set of integers (i.e. a vector of
I need help writing this function that requires only one recursive call.
Problem 7. Power Set. Given a set of integers (i.e. a vector of distinct integers-sets do not have repeats). Find and print the Power Set of the given set (except for an empty subset). There is one recursive call. Definition: The Power Set of a given set of integers A is the set of all subsets of A including an empty subset and the entire A itself. Example: A -12, 5,4], PowerSet(A), 121, f5], 12, 5], (4], 12, 41, (5, 41, (2, 5,4]] You need to write the following function with the exact header as shown void powerSet(const vectorcint> &A, vector >&P, int last); Initially, vector P (power set of A) is empty, and by the end of execution, it will contain the power set of A (except for the empty subset)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
