I need to find the 2 highest numbers on an array of numbers. I can't use the sorting fiture.
Any help will be appreciated,
Initialize highval and secondhighval to a value that is lower than any possible value in the data.
Then, iterate through the array with the following logic:
If curval > highval Then
secondhighval = highval
highval = curval
Else If curval > secondhighval Then
secondhighval = curval
After you have iterated through all of the data, if highval and secondhighval both have valid values, you will have found the two highest values.