what you can do is create a vector <pair<int,int>> and sort it on the baisis of secondary key where it will be it's frequency. if tha range is not given. If the range is in permissible limits, then hash table is the answer. I suppose.
On Tue, Dec 14, 2010 at 11:45 PM, Ankur Khurana <[email protected]> wrote: > @sajj: if the range of number is not given then ? > > On Tue, Dec 14, 2010 at 11:41 PM, sajj <[email protected]> wrote: >> you can use hash table for this dude. >> >> On Dec 14, 8:22 pm, Prims <[email protected]> wrote: >>> given some positive numbers >>> output the numbers in decreasing order of frequency..in case of a tie >>> print the number which occurred first >>> >>> for eg: 1,3,3,1,2,3,5,2,3 >>> the output should be 333311225 >> >> -- >> 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.
