subsets of a given array
// C++ code to print all possible
// subsequences for given array using
// recursion
#include
using namespace std;
// Recursive function to print all
// possible subsequences for given array
void printSubsequences(int arr[], int index,
vector subarr,int n)
{
// Print the subsequence when reach
// the leaf of recursion tree
if (index == n)
{
for (auto it:subarr){
cout << it << " ";
}
if(subarr.size()==0)
cout<<"{}";
cout< vec;
printSubsequences(arr, 0, vec,n);
return 0;
}
// This code is contributed by
// vivekr4400
|