GATE Computer ScienceEasyGATE CS (PYQ pattern)
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)?
- A. 64
- B. 31
- C. 80
- D. 96
Correct answer: C. 80
Put m = log₂ n and S(m) = T(2^m): S(m) = 2S(m/2) + m, S(1) = 1. So S(2) = 4, S(4) = 12, S(8) = 32, S(16) = 80 (= m log₂ m + m). Forgetting the base case gives 64; dropping the factor 2 gives 16+8+4+2+1 = 31.
More Algorithms questions
- 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…
- What is the minimum number of comparisons that guarantees finding the second largest of 1025 distinct numbers in the worst case?
- Top-down merge sort splits n elements into a left part of ⌈n/2⌉ and a right part of ⌊n/2⌋, and its merge stops comparing as soon as one…
- The keys 3, 9, 2, 1, 4, 5, 7, 8, 6, 10, 11, 12 are inserted, in this order, one at a time into an initially empty binary max-heap, each…