if we use brute force we have sum(n + n-1 + .. n-r .. + 1) = n*n words which are to be checked. Therefore O(n-sq).
now, if i can use a dictionary interface to reject some prefix altogether, than i need not check some words, o/w with the given interface we cannot do it any better than quadratic time. On Tue, Oct 4, 2011 at 6:23 PM, Navneet <[email protected]> wrote: > What is the source of this question? > > On Sep 20, 4:49 am, Ankur Garg <[email protected]> wrote: > > nice find bhanu..though i didnt get much :P on first read :D :D > > > > On Tue, Sep 20, 2011 at 4:34 AM, Bhanu Kishore <[email protected] > >wrote: > > > > > > > > > > > > > > > > > See this algorithm: > > >http://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_string_matching_alg. > .. > > > > > -- > > > 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. > > -- > 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. > > -- Nice Day Abhishek Sharma Bachelor of Technology IIT Kanpur (2009) -- 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.
