GATE Computer ScienceVery hardGATE CS (PYQ pattern)
Solve T(n) = 2T(√n) + log₂ n for large n. Which is the tight bound?
- A. Θ(log n · log log n)
- B. Θ(log n)
- C. Θ(log² n)
- D. Θ(log n · (log log n)²)
Correct answer: A. Θ(log n · log log n)
Put m = log n and S(m) = T(2^m): S(m) = 2S(m/2) + m, which is the merge-sort recurrence, so S(m) = Θ(m log m) and T(n) = Θ(log n · log log n).
More Algorithms questions
- Let T(n) = T(n − ⌊√n⌋) + 1 for n > 1 and T(1) = 0. Which is the tight bound?
- Let T(n) = T(n/2) + n(2 − cos n) (n in radians) with T(1) = 1. Which statement about T(n) is correct?
- How many times does x++ execute? for (i = 1; i <= 64; i = 2) for (j = 1; j <= i; j++) for (k = j; k <= i; k = 2) x++;
- How many times does x++ execute? for (i = 1; i <= 200; i++) { j = 1; while (j <= i) { x++; j = 3; } }
- How many balanced parenthesis strings with 6 pairs have nesting depth at most 2?
- In how many ways can a 2 × 10 rectangle be tiled with 2 × 1 dominoes (either orientation) and 2 × 2 squares?