GATE Computer ScienceHardGATE CS (PYQ pattern)
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?
- A. Θ(n² log n)
- B. Θ(n²)
- C. Θ(n³)
- D. Θ(n² log² n)
Correct answer: A. Θ(n² log n)
Akra–Bazzi: find p with 2·(1/2)^p + 8·(1/4)^p = 1. p = 2 works (2/4 + 8/16 = 1). Then T = Θ(n^p (1 + ∫₁ⁿ u²/u³ du)) = Θ(n² log n): f(n) = n² exactly matches n^p, so every level costs about n² and there are Θ(log n) levels.
More Algorithms questions
- 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…
- The array [5, 3, 17, 10, 84, 19, 6, 22, 9, 15, 2] is turned into a max-heap by Floyd's linear-time Build-Max-Heap. Which array results?…