GATE Computer ScienceVery hardGATE CS (PYQ pattern)
The solution of the recurrence T(n) = 2T(n/2) + n/log n (with T(1) = 1, logs base 2) is:
- A. Θ(n log n)
- B. Θ(n)
- C. Θ(n log log n)
- D. Θ(n log² n)
Correct answer: C. Θ(n log log n)
At level i the cost is n/(log n − i), so the total is n × (1/log n + 1/(log n − 1) + … + 1) = n × H(log n) = Θ(n log log n). The master theorem does not apply because f(n) is only polylogarithmically smaller than n.
More Algorithms questions
- The solution of T(n) = 4T(n/2) + n² log n is:
- Matrices A1 to A6 have dimensions 5×40, 40×10, 10×30, 30×8, 8×25 and 25×6. The minimum number of scalar multiplications needed to compute…
- A text uses 8 symbols with frequencies 5, 9, 12, 13, 16, 45, 3 and 7. If a Huffman code is built, the total number of bits needed for the…
- A 0/1 knapsack has capacity 50 and items given as (value, weight): (60, 10), (100, 20), (120, 30), (75, 25). The maximum total value is:
- Which of the following statements are correct? (I) 2-SAT can be solved in polynomial time. (II) Subset-sum has a pseudo-polynomial…
- An AVL tree is a binary search tree in which the heights of the two subtrees of every node differ by at most 1. Taking the height of a…