There is a set contains N number of elements. You have to find out all the possible subsets of the given set and print them
belongs to collection: interview C++ coding problems/challenges | Backtracking
All Answers
total answers (1)
belongs to collection: interview C++ coding problems/challenges | Backtracking
total answers (1)
Let, there is a Set S having N number of elements,
The process to print the subsets of the set is a problem of combination and permutation. To get the result we use the backtracking process.
Here, we take a subset of that set in our consideration and consider two things,
Algorithm:
Here we use the vector STL to store the subsets.
C++ implementation:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer