GATE Computer ScienceVery hardGATE CSE
Five keys k1<k2<k3<k4<k5 are searched with access frequencies 4, 2, 6, 3, 9. For a binary search tree over these keys, with the root at depth 1, the minimum possible total of (frequency × depth) is
- A. 51
- B. 47
- C. 44
- D. 56
Correct answer: B. 47
The optimal-BST DP (cross-checked by exhaustive recursion) gives 47.
More Algorithms questions
- What is the minimum number of comparisons needed in the worst case to find the SECOND smallest of 100 distinct elements?
- Consider T(n) = 2T(n/2) + n/log₂n for n ≥ 2 (n a power of 2, T(1) = 1). Which is the tightest bound? (The Master theorem in its basic form…
- Let T(n) = 2T(√n) + log₂ n for n > 2, with T(2) = 1, where n is always of the form 2^(2^k). What is the exact value of T(2^16)?
- Consider T(n) = 2T(n/2) + 8T(n/4) + n² with T(1) = 1 (the subproblem sizes add up to 3n, not n). Which is the tight bound?
- Let T(n) = 2T(n/2) + n·log₂ n for n ≥ 2, T(1) = 1, with n = 2^k. Which is the exact closed form of T(n)?
- An adversarial quicksort always splits an input of size n into parts of sizes n/10 and 9n/10, so T(n) = T(n/10) + T(9n/10) + n. For large…