GATE Computer ScienceHardGATE CS (PYQ pattern)
Solve T(n) = √n·T(√n) + n·log₂ n for n = 2^(2^k), with T(2) = 2. Which is the tight bound?
- A. Θ(n log n log log n)
- B. Θ(n log log n)
- C. Θ(n log² n)
- D. Θ(n log n)
Correct answer: D. Θ(n log n)
Divide by n: S(n) = T(n)/n satisfies S(n) = S(√n) + log₂ n. The terms log n, (log n)/2, (log n)/4, … form a geometric series, so S(n) = Θ(log n) and T(n) = Θ(n log n) (T(n)/(n log₂ n) → 2). Multiplying n log n by the log log n levels overcounts, since the level costs halve.
More Algorithms questions
- The maximum and the minimum of n numbers are found by divide and conquer: a list of 1 element needs 0 comparisons, 2 elements need 1; a…
- The strings X = XYXZYXZ and Y = YZXYXZY are given. Their longest common subsequences all have length 5. How many distinct strings of…
- The edit distance between PNEUMONIA and AMMONIA is computed with insertion, deletion and substitution each costing 1. What is the minimum…
- Matrices A₁ … A₇ have dimensions 5×12, 12×7, 7×20, 20×4, 4×15, 15×9 and 9×6, i.e. the dimension array p = [5, 12, 7, 20, 4, 15, 9, 6]…
- A recursive matrix-chain function without memoisation, cost(i, j), returns 0 when i = j and otherwise calls cost(i, k) and cost(k+1, j)…
- A 0/1 knapsack has capacity 26 and items (weight, value): (12, 24), (7, 13), (11, 23), (8, 15), (9, 16), (6, 11). The maximum total value…