I'm trying to figure out an algorithm to find the highest 2 numbers in a list of numbers.
The highest number can be found in n-1 stages, perhaps by doing the fist step of a bubble sort or something along those lines. To me it seems that finding the next highest number as well could be found in a total of 1.5n comparisons on average.
My professor set us homework to write an alogrithm that finds the highest 2 numbers in n + log(n) comparisons. Is this even possible? Any ideas, suggestions?
Edit: When I say n + log(n) I'm not referring to O(n + log n), but rather exactly n + log n