sir, In void Subsequence function what is the use return ,where its returning
code:
using namespace std;
#include
void print_subsequence(int out[],int j)
{
cout<<"{";
for(int i=0;i<j;i++)
cout<<out[i];
cout<<"}\n";
}
void subsequence(int in[],int out[],int i,int j,int n)
{
//base case
if(i==n)
{
print_subsequence(out,j);
return; //???
}
//Rec case
//1. Include the current element
out[j]=in[i];
subsequence(in,out,i+1,j+1,n);
//2. Exclude the current Element
subsequence(in,out,i+1,j,n);
}
int main()
{
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
int in[n],out[n];
for(int i=0;i<n;i++)
cin>>in[i];
subsequence(in,out,0,0,n);
}
}