There is a set contains N no. of unsorted characters. You have to find out the power sets in lexicographic order of a given set of numbers and print them
belongs to collection: interview C++ coding problems/challenges | Backtracking
All Answers
total answers (1)

C++ programming
Algorithm:
Here we use the vector STL to store the subsets.
traverse(arr, n, current_pos,set,subset){ if(Current_pos is greater or equals to the n)Then return end if for i= current_pos to the end of the set insert the element of arr[i] into subset insert the subset into the set traverse(arr,n,i+1,set,subset) pop the element from subset end for }C++ implementation:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer