Stack can be used to push the characters of the string A and then popped off while scanning through the string B until there is a difference in the character read from the string B and the one popped off from the stack..
On Jul 20, 4:40 pm, agnibha nath <agni.fl...@gmail.com> wrote: > You can try rabin-carp.. > > 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. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.