1.5n . , min max. n/2, (locals) max n/2, min. , n.
Now you go to max and min locals and find global max and min. It also involves comparison n/2. In this way n + n / 2 = 1.5n.
If the array is sorted, you can find it without any comparisons, since the lowest number is at position 0 and the highest is at position N - 1.
source
share