Given a permute array you want to create fixed set of elements in
which s does not occur. Modify the below function:
void
permuteStr(char *out, char *permuteArr,
unsigned char outSize, unsigned int permuteArrSize,
int index, void (*outStr)(char *))
{
if (index == outSize){
(*outStr)(out);
return;
}
for (unsigned char i = 0; i < permuteArrSize; i++){
out[index] = permuteArr[i]+'0';
permuteStr(out,permuteArr, outSize,permuteArrSize, index+1,
outStr);
}
}
void
printStr(char * s)
{
printf(s);
printf("\n");
}
USAGE:
char s[2];
s[2] = (char)0;
char permute[4];
permute[0] = 1;
permute[1] = 2;
permute[2] = 3;
permute[3] = 4;
permuteStr(s,permute,2,4,0, &printStr);
In The printStr function determine if the string contains s as a
substring.
On Nov 28, 6:59 pm, John <[EMAIL PROTECTED]> wrote:
> Given an alphabet sigma={A,B,C.....Z} and a string S, generate all
> strings of length 'n' which do not contain a given string S as a
> substring.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---