All Exams Test series for 1 year @ ₹349 only
Question

Which of the following is correct solution of the given recurrence relation? $T(n) = 3T(n/4) + n \log n$

The correct answer is
$\theta (n \log n)$

To find the solution to the given recurrence relation, we use the Master Theorem. The recurrence is:

\(T(n) = 3T(n/4) + n \log n\)

The Master Theorem provides a way to determine the asymptotic behavior of recursive programs. It states:

For a recurrence of the form \(T(n) = aT(n/b) + f(n)\) where:

  • \(a \geq 1\) is the number of recursive calls
  • \(b > 1\) is the factor by which the subproblem size is divided
  • \(f(n)\) is an asymptotically positive function

The asymptotic behavior of \(T(n)\) is determined by comparing \(f(n)\) with \(n^{\log_b a}\):

  1. If \(f(n) = \Theta(n^{\log_b a-\epsilon})\) for some \(\epsilon > 0\), then \(T(n) = \Theta(n^{\log_b a})\).
  2. If \(f(n) = \Theta(n^{\log_b a} \log^k n)\) where \(k \geq 0\), then \(T(n) = \Theta(n^{\log_b a} \log^{k+1} n)\).
  3. If \(f(n) = \Theta(n^{\log_b a+\epsilon})\) for some \(\epsilon > 0\), then \(T(n) = \Theta(f(n))\).

Now, applying these to the recurrence relation:

  • \(a = 3\)\(b = 4\)\(f(n) = n \log n\)
  • Calculate \(n^{\log_b a} = n^{\log_4 3}\)

We need to compare \(f(n) = n \log n\) with \(n^{\log_4 3}\).

Since \(\log_4 3 \approx 0.792\), we compare:

\(n \log n\) versus \(n^{0.792}\)

Clearly, \(n \log n\) grows faster than \(n^{0.792}\). Thus, we are in the third case of the Master Theorem. Therefore, the solution is:

\(T(n) = \Theta(n \log n)\)

This matches with the option:

\(\theta (n \log n)\)

 

Was this answer helpful?

Important Questions from Recurrences

  1. Divide and Conquer is an algorithmic paradigm that solves problems by:

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App