Wouldn't that be O(n2) . what if n, ne, new, news, newsp etc all are valid words ? Cant it be optimized?
On Tue, Jan 11, 2011 at 6:27 PM, juver++ <avpostni...@gmail.com> wrote: > Use trie (or similar DS). > For each word, try to find second part of the target in a linear time > O(length). > > -- > 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.