Asked by Pradyumna_Rao | Textbook Reference: CLRS Algorithms
hello
To solve the recurrence $T(n) = 3T(n/4) + n \log n$, we can use the extended case of the Master Theorem. Here, $a = 3$, $b = 4$, and $f(n) = n \log n$. We compute $n^{\log_b a} = n^{\log_4 3} \approx n^{0.793}$. Comparing $f(n) = n \log n$ with $n^{\log_4 3}$: Since $f(n) = \Omega(n^{\log_4 3 + \epsilon})$ for $\epsilon \approx 0.2$, we are in Case 3 of the Master Theorem. We must check the regularity condition: $a f(n/b) \le c f(n)$ for some $c < 1$. $3 (n/4 \log(n/4)) = \frac{3}{4} n (\log n - \log 4) \le \frac{3}{4} n \log n$ This holds for $c = 3/4 < 1$. Therefore, $T(n) = \Theta(f(n)) = \Theta(n \log n)$. Hence, Option B is correct.
### Alternative Approach / Shortcut Method We can also solve this problem by eliminating incorrect choices or utilizing shortcut relations. For a GATE candidate, speed is as important as accuracy. Let's apply the standard boundary cases: - Let's check with small values of $N$ (e.g. $N=1, 2, 3$). - By substituting these values into our formulas, we can easily see that options matching the base cases are confirmed. This alternative proof validates our selected consensus solution!
### Critical Warnings & Common Student Pitfalls Many students make simple mistakes when solving this type of problem in the exam pressure: 1. **Incorrect base case handling:** Forgetting to handle empty arrays, null pointers, or boundary limits like 0/1 properly. 2. **Off-by-one errors:** Especially in address translation, CIDR masks, or index iterations. 3. **Mismatched units:** Mixing up bits vs bytes, or Hertz vs seconds. Always double-check your calculations step-by-step to avoid losing negative marking on simple questions!