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.