Medium Strategy

Given an array of n numbers. Finding minimum takes n-1 comparisons. Finding maximum takes n-1 comparisons. If you had to simultaneously find both minimum and maximum, can you do it in less than 2n-2 comparisons?

Hint
Solution
Source: H. Cormen
Enable Like and Comment




© BRAINSTELLAR