Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void combinationUtil(set*,int n,int r,int index,string data[],int i);
- void printCombination(set* fr, int n, int r)
- {
- string data[r];
- combinationUtil(fr, n, r, 0, data, 0);
- }
- void combinationUtil(set* fr, int n, int r, int index, string data[], int i)
- {
- if (index == r)
- {
- cout<<"{";
- for (int j=0; j<r; j++)
- //cout<<data[j];
- ;cout<<"}";
- return;
- }
- if (i >= n)
- return;
- cur = fr;
- int j = i;
- while(j--){
- cur=cur->next;
- }
- data[index] = cur->name;
- combinationUtil(fr, n, r, index+1, data, i+1);
- combinationUtil(fr, n, r, index, data, i+1);
- }
- string powerSet(char x){
- set1=search(x);
- set1=set1->next;
- //cout<<set1->name;
- int count=0,i;
- while(set1){
- set1=set1->next;
- //cout<<set1->name;
- count++;
- }
- set1=search(x);
- set1=set1->next;
- for(i=0;i<=count;i++)
- printCombination(set1,4,i);
- return "hello";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement