The second smallest of n elements can be found with ____________ comparisons in the worst case.
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: C. n + ⌈log n⌉ − 2
Explanation
A tournament finds the minimum in n − 1 comparisons; the second smallest lost directly to the minimum, among ⌈log n⌉ candidates, needing ⌈log n⌉ − 1 more.
More Data Structures and Algorithms questions
- Consider the pseudo-code fragment, where m is a non-negative integer that has been initialized: p = 0; k = 0; while (k < m) p = p + 2^k; k…
- The solution of the recurrence relation T(m) = T(3 m/4) + 1 is :
- Consider the array A=<4, 1, 3, 2, 16, 9, 10, 14, 8, 7>. After building heap from the array A, the depth of the heap and the right child of…
- Which of the following algorithms solves the single-source shortest paths ?
- A text is made up of the characters A, B, C, D, E each occurring with the probability 0.08, 0.40, 0.25, 0.15 and 0.12 respectively. The opt…
- A binary search tree in which every non-leaf node has non-empty left and right subtrees is called a strictly binary tree. Such a tree with…