I have a question regrading 2d array. If one column in array stores values and second column stores numbers. For example,
0.1 1
-0.4 4
0.7 2
0.2 5
Then how can I find the number stored at maximum value in 2d array? In this example (max value is 0.7 so the number should 2).
How would you seek the maximum value from a 1D array?
Rather than keeping track of the largest value found so far, store the index of the element, where the largets value was found.
A problem in your "2D array" is that the values are float, but the numbers are ints and array can have only one value-type. How about storing a list/array of (float,int) pairs?