[algogeeks] finding string in matrix grid
check whether a string is present in matrix grid (either horizonatal(left to right), vertical(top to boottom) ,reverse horizonatal(right to left) reverse vertical(bottom to top). i think the question is clear. first try to give solution for horizontal and vertical only, just give the logic -- 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.
Re: [algogeeks] finding string in matrix grid
Hey, Tell me if this assumption of the problem statement is correct.. String: ram Matrix: |r | a b |a | g h |m| j d This is vertical and similar for its horizontal counter part... So the logic is more than obvious, For vertical (and horizontal), do a sub-string search column-wise and (row-wise for horizontal) wrt the string. Using KMP It'd be O(mn) for an MxN matrix -- 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.