On Sep 8, 10:47 am, yash <yashpal.j...@gmail.com> wrote:
> wap a program in efficient manner to remove all occurrence of
> duplicate character in the word and all occurrence of duplicate word
> in the file.
>
> i break the problem in two section( this is my approach it may be
> better one )
>
> wap to remove all duplicate character in the word. (order is important)
> [i don't know which DS we use for this program your suggestion has
> highly appreciated]
> wap to remove all duplicate word in the file. (order is important)[we
> use tries to remove all duplicate word in the file]
>
> input in file
>
> we welcome your feedback, suggestions comment to make better your
> world
>
> After run the above compression algo output will be
>
> we welcom your fedback, sugtion coment to make betr world
>
> --
> Kind Regards
>   ^_^
> Yashpal Jain
> Software Developer-IDC Risk
> PayPal - an ebay company

For the first Problem :

void RemDuplicate(char buf[])
{
 size_t i = 0,t;
 int alph[256] = {0};
 char *p = buf;
 while(buf[i]){
        alph[buf[i]] = 1;
        i++;
 }

 for(t = 0,i = 0;buf[i];i++)
         if(alph[buf[i]]){
                 p[t++] = (char)buf[i];
                  alph[buf[i]] = 0;
         }
        p[t] = 0;

}

--~--~---------~--~----~------------~-------~--~----~
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 
algogeeks+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to