This is a interview question: given an array of integers find the max. and min. using minimum comparisons.
Obviously, I can loop over the array twice and use ~2n
comparisons in the worst case but I would like to do better.
This is a interview question: given an array of integers find the max. and min. using minimum comparisons.
Obviously, I can loop over the array twice and use ~2n
comparisons in the worst case but I would like to do better.