Hi Anuragh,
                   Your stack method does not seem to work. The first
element popped out of stack A will be p. But the first character in B is t.
It does not match in the first step itself.

-Regards,
Mallesh

On Wed, Jul 21, 2010 at 6:17 PM, anugrah <anugrah.agra...@gmail.com> wrote:

> Stacks can be used.
>
> On Jul 20, 4:18 pm, mallesh <mallesh...@gmail.com> wrote:
>  > We are given two strings. A and B.
> >
> > First few letters of A match with Last letters of B. We have to find
> > the longest match in linear time.
> > Example:
> > char * A ="This is my first post to this group";
> > char *B= "to this group this is my post";
> >
> > Algorithm should return starting position of substring "to this group"
> > in string A.
> >
> > How do we do this?
> >
> > -Thanks and regards,
> > Mallesh
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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?hl=en.

Reply via email to