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++ <[email protected]> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
