@above I said some augmentation , that's why I said it (And also I like tries :D) If some non-determinism is condoned , may be you can use Rabin-Karp method to improve upon storage .
On Feb 2, 1:28 pm, snehal jain <learner....@gmail.com> wrote: > @ above > you approach trie needs lot of optimization.. this will take up lot of > space...trie is suitable in case where we want to reduce search complexity > and its space complexity is very bad.. so hashing should be better here as > compared to trie.. > > i think shashank's solution is better... > > On Tue, Feb 1, 2011 at 7:15 PM, sankalp srivastava < > > > > richi.sankalp1...@gmail.com> wrote: > > I think , as juver++ said , you should also try reading on the > > internet about these kinds of problems .This can be solved with an > > augmentation of a trie (keeping a count variable at the leaf > > ( maintaining a counter for all the word frequencies > > accordingly )) .Just print the top ten results in the end .time > > complexity will be O(n , log n ) .We can improve upon this solution a > > lot using other forms of tries and some augmentation > > > PS:This will take some time if we do it for n characters , but since > > you explicitly asked for 10 characters , so be it ! > > > For your second question , try seraching "globbing" (For the > > masochists , download the source code for glob library and go through > > the code ) > > > -- > > 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<algogeeks%2Bunsubscribe@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 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.