GATE Computer ScienceHardGATE CS (PYQ pattern)
T(n) = 4T(n/2) + n² log₂ n. Which is the tight solution?
- A. Θ(n² log n)
- B. Θ(n² log² n)
- C. Θ(n² )
- D. Θ(n³)
Correct answer: B. Θ(n² log² n)
f(n) = n^(log_b a)·log n, so the extended case gives Θ(n² log² n): each of the log n levels costs n²·(log n − i), summing to Θ(n² log² n).
More Algorithms questions
- 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…
- Characters may be added ONLY at the front of the string abacdcabxab. What is the minimum number of characters that must be added to make…