@ Arun : I guess what ever solution you have proposed will give us the most frequantly used N words out of the whole document .As you said, getting K largest element out of total elements. Here we want , last N words in the document in the decreasing order of their occurance.
2009/8/17 richa gupta <richa.cs...@gmail.com> > @dufus : > > suppose the words occurs like ( at the last of the document or u can say > that in the window of size N , the scenario is ) > l, b,b,b, c , d,d, e a > so ur max heap will make it > b(3) > d(2) c(1) > e(1) a (1) l(1) > > now explain me what happens when b or d or some new word "m" > > > > > > > 2009/8/16 Miroslav Balaz <gpsla...@googlemail.com> > > I think the teoreticaly easiest solution is to have two balanced binary >> search trees interlinked. on for finding by string, second for keeping count >> second can keep subtree sizes, and every time you check the position and >> if it changes then you can update list, you do not have to make more >> computation than is needed to redraw screen and to maintain balanced tree. >> >> 2009/8/14 richa gupta <richa.cs...@gmail.com> >> >> >>> You have to develop a piece of code that can be attached to a program >>> like Microsoft Word, which would list the last "N" words of the >>> document in descending order of their occurence, and update the list >>> as the user types. What code would you write? Using pseudo code is >>> fine, just list the basic things you would consider >>> >>> -- >>> Richa Gupta >>> (IT-BHU,India) >>> >>> >>> >> >> >> >> > > > -- > Richa Gupta > (IT-BHU,India) > -- Richa Gupta (IT-BHU,India) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---