GATE Computer ScienceModerateGATE CSE
What is the asymptotic solution of T(n) = 3T(n/2) + n² with T(1) = 1?
- A. Θ(n^1.585)
- B. Θ(n² log n)
- C. Θ(n³)
- D. Θ(n²)
Correct answer: D. Θ(n²)
Here a = 3, b = 2 and n^(log₂3) ≈ n^1.585 is polynomially smaller than f(n) = n². Case 3 of the master theorem holds (regularity 3(n/2)² = 0.75n² ≤ cn²), so T(n) = Θ(n²).
More Algorithms questions
- Selection sort (find the minimum of the unsorted part and exchange it with the first unsorted position, skipping the exchange when the…
- How many inversions (pairs i < j with A[i] > A[j]) does the array [8, 4, 2, 1, 7, 3, 6, 5] have?
- A max-heap is built from [3, 9, 2, 1, 4, 5, 8, 7] by the bottom-up method (Max-Heapify from the last internal node down to the root…
- A file uses six symbols with frequencies 5, 9, 12, 13, 16 and 45. What is the total number of bits needed to encode the file with an…
- In a 0/1 knapsack of capacity 11, the items have (weight, value) = (3,3), (4,4), (5,4), (9,10), (4,4). What is the maximum total value?
- What is the length of a longest common subsequence of PROGRAMMING and ALGORITHM?