How many comparisons are needed to find the minimum element in a set? The maximum?
Can we find the minimum and maximum with less than twice the cost?
- Walk through elements by pairs
- Compare each element in pair to the other
- Compare the largest to maximum, smallest to minimum
- Total cost: 3 comparisons per 2 elements = O(3n/2)