initial call
subset(a,n,r,0,0);
printf("%d",count);//to know the value of nPr (no of subsets)
*
void subset(int a[],int n,int r,int j,int ind)
{
int i;
if(ind==r)
{
printf("{");
for(i=0;i<ind;i++)
printf("%d ",a[i]);
printf("}\n");
count++;
}
else if (ind<r)
{
for(i=j;i<n;i++)
{
swap(&a[i],&a[j]);
subset(a,n,r,j+1,ind+1);
swap(&a[i],&a[j]);
}
}
}*
--
*Piyush Sinha*
*IIIT, Allahabad*
*+91-7483122727*
* <https://www.facebook.com/profile.php?id=100000655377926> "NEVER SAY
NEVER"
*
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.