Re: [algogeeks] most efficient way to calculate mode in an array of numbers

2010-05-25 Thread Amir hossein Shahriari
since we have to visit each value at least once we have to do at least O(n) steps so there cant be a solution in time less than o(n) but if the range of the values is limited we can use another array to count the number of occurrences of each value and the complexity would be: o(n) time o(max of th

[algogeeks] most efficient way to calculate mode in an array of numbers

2010-05-25 Thread Raj N
Hi, Can anyone tell me what is the most efficient algo to find the mode. Is it sorting and the then finding the max occurrence or can it be done in time less than O(n) ? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, s