with space O(n) and time O(n), we can trace the whole array and maintain the freq of each number.... and by one more trace with using 3 variables , we can find top 3 ........
On Wed, Sep 14, 2011 at 11:20 AM, raj <[email protected]> wrote: > program to find the top 3 repeating number from the given array > eg > You r given an array and u have to find out the top 3 repeated > numbers. > for ex: GAURAV[]={20,8,3,7,8,9,20,6,4,6,20,8,20} > so the output will be: 20 is repeated 4 times 8 is repeated 3 times 6 > is repeated 2 times. > > -- > 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. > > -- **Please do not print this e-mail until urgent requirement. Go Green!! Save Papers <=> Save Trees *BharatKumar Bagana* **http://www.google.com/profiles/bagana.bharatkumar<http://www.google.com/profiles/bagana.bharatkumar> * Mobile +91 8056127652* <[email protected]> -- 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.
