for second question think of the given string as some overlapping strings
with overlap length of length(pattern) -1.

now appy strstr/KMP in parallel to these substrings


Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652


On Tue, May 1, 2012 at 11:36 AM, vikas <vikas.rastogi2...@gmail.com> wrote:

> 1) you cannot escape but exhaustive search, trying all possibilities
>
> 2) basically you are asked to find string in stream, just try to do
> similar of Boyce-Moore , seems good for this problem.
>
> On Mar 30, 8:47 pm, Decipher <ankurseth...@gmail.com> wrote:
> > This was asked from my friend in January for MTS profile.
> >
> > Q1) Given a matrix with letters in each square and you have to find words
> > which are there in the dictionary (like Children's Crosswords). You have
> > been given a function which outputs 1 if the given word is in the
> > dictionary. The word could be bidirectionally horizontal, vertical
> > or diagonal. Write an optimal algorithm for printing all such words.
> >
> > Q2) Given a very large string in which there is no kind of delimiter and
> > you have been given function strstr() . Find a given string in the larger
> > string using that function using minimum time and space.
>
> --
> 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?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 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?hl=en.

Reply via email to