One solution to this problem is that : char s[]="abracadbra"; char p[]="bca"; char temp[];
1. First Remove element b of array p from array s . Compare b of array p with with characters of array s . if b is not matched with characters of array s insert those characters of s into new temp array . continue this till s reaches '\0'; now again reassign the reduced characters of temp array back into array s; continuously repeat the step 1 for another characters in p till p become or reaches '\0' ; finally you have an array which doesn't have characters which are there in p array; I think it only need an extra temporary array , but at each interation array size is getting reduced & as well no. of time to compare elements is also get reduced . If any one have questions please ask; Thank you , --- Regards Peeyush Bishnoi On 8/7/07, Arulanandan P <[EMAIL PROTECTED]> wrote: > > You have to write a function whose prototype is given bellow. this > function will accept two char * named subject and pattern. for example > subject="abracadbra" > and pattern="bca".now it should check occurrences of all chars of string > pattern in subject . If any match occurs then it will remove that char from > subject . so finally , as in our example > at end subject ="rdr" > > void fun(char *subject,char *pattern) > { > // write your code here > } > > > -- ---- Peeyush Bishnoi --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---