Wednesday, February 23, 2011

WAP tp print Combination of given string

#include
#include
#include

void mycombination(char const * const s, int l, int *arr, int index, int start, int d)
{
int i,j;
if (index >= d)
return ;
for (j = start ; j < l ; j++)
{
arr[index] = j;
if (index == d-1)
{
for (i=0;i putchar('\n');
}
else
mycomb_ultrabad(s,l,arr,index+1,j+1,d);
}
return ;
}

int main()
{
int i,d;
char s[4]={'a','v','i'};
d = strlen(s);
int arr[d+1];
for (i=0;i {
mycomb_ultrabad(s, d, arr,0,0,d-i);
}
return 0;
}

No comments :