Taking for granted that KMP algorithm searches for a given string of
length n in a string of length m in O(n+m) time,

How do we solve this puzzle in linear time?




On Thu, Jul 22, 2010 at 1:29 PM, sharad kumar <aryansmit3...@gmail.com>wrote:

> @all:pls make use of KMP algorithm...because knuth morris prat algor
>
>
> On Wed, Jul 21, 2010 at 6:16 PM, anugrah <anugrah.agra...@gmail.com>wrote:
>
>> 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<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> yezhu malai vaasa venkataramana Govinda Govinda
>
> --
> 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