Back to Archive
#92strategy
medium

Min & Max

Source: H. Cormen

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?

Discussion

0

You must be logged in to participate in the discussion.

No comments yet. Be the first to start the conversation!