they ask for an element which should not be minimum or maximum so We only need to consider any 3 elements and compare them. So the number of comparisons is constants, that makes time complexity as Θ(1)
Let us take an array {11, 20, 16, 7, 90}. Output can be 11 or 16 or 20 as
min = 7 and max = 90
Pick any three elements from given list. Let the three elements be 11, 20 and 7.
Using 3 comparisons, we can find that the middle element is 11.
meaning need to find middle element from 3 elements