2nd smallest number from 32 numbers

1,443.4K Views

You have 32 numbers. What is the least number of comparison needed to find the 2nd smallest out of them?

Share
Mehar Starter Asked on 31st July 2015 in Interview Puzzles.
Add Comment

  • 1 Answer(s)

    35 comparisons

    Explanation:

    You can create a tournament to find the smallest in 31 comparisons. If we need to find the second smallest, we only need to determine the smallest between those which lost to the smallest. If we use a balance binary tree, there are at most 5 such values which require 4 comparisons.

    Pranav Jain Scholar Answered on 27th April 2016.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.
  • More puzzles to try-