I have an array, say A = [ 3 5 6 7 ]. I know I can get the maximum value of this array with max(A) and it returns 7, but how can I get the second max (6) from this array without sorting or removing the first maximum value?
I have an array, say A = [ 3 5 6 7 ] .
Share
I can propose following tricky solution:
Here
A(A~=max(A))will be temporary array that not contain maximal value of original array. Than you receive maximum of this array.