GATE Computer ScienceHardGATE CS (PYQ pattern)
Consider T(n) = 2T(n/2) + n/log₂²n for powers of 2, T(1) = 1. Which is the tight asymptotic bound?
- A. Θ(n log log n)
- B. Θ(n log n)
- C. Θ(n/log n)
- D. Θ(n)
Correct answer: D. Θ(n)
Level i costs n/(log n − i)², so the total is n·Σ_{j=1}^{log n} 1/j² ≤ n·π²/6 = O(n); the leaf level already gives Ω(n). The 1/log n case would give n log log n, but the square makes the series converge.
More Algorithms questions
- T(n) = 4T(n/2) + n² log₂ n. Which is the tight solution?
- Binary search on a sorted array of 1000 distinct keys uses mid = ⌊(lo + hi)/2⌋ and counts one probe per element compared (the search stops…
- A binary min-heap holds 100 distinct keys in A[1..100]. At how many different positions can the SECOND largest key possibly be?
- Two sorted lists of 8 keys each are merged by the standard merge, which stops comparing when one list runs out. All C(16, 8) = 12870…
- What is the length of the longest common subsequence of the three strings X = BDCABACDB, Y = ABCBDABDC and Z = BCADBDACB?
- The longest repeating subsequence of a string is the longest subsequence that occurs twice, where the two copies may overlap in positions…