Find the top 3 numbers in a list

Oct 27, 2012 at 1:39pm
I made a list of numbers that the user inputs, and then the program has to find what 3 are the largest, but im not sure how to find the top 3
Oct 27, 2012 at 1:46pm
How would you do it on paper if I gave you a list of numbers? Do it like that.
Oct 27, 2012 at 2:30pm
It is unsolvable task if the list contains less than three elements!:)
Oct 27, 2012 at 4:23pm
Sort the list and then take the last 3 numbers or figure out what math algorithm can be used to find them in the quickest amount of time.
Oct 27, 2012 at 4:26pm
The easiest way is sure the STL sort() function, but I guess you have to work with a simple array of integers and not the algorithm and vector libraries.
Let us know if you got any issues (after you actually try to write that program).
Topic archived. No new replies allowed.