0

favour how can I find thr 2nd minimum element in a 2d array. please give me the code

9/9/2016 4:16:46 AM

Shoham Chandra

1 Answer

New Answer

+1

Have two variables for min and min2, initialized at values higher than the values you can find in the 2d array. Use nested loops to browse the array, comparing each value with min, and when it's lower than min, put the value of min in min2, and update min. After the main loop ends, min2 will have the 2nd min value of the 2d array (provided the array has at least two elements).