Proving $T(n)=O(n^2 \lg^2 n)$ Using Recurrence Relation

In summary, the author tries to prove that $T(n)=4 T \left ( \frac{n}{2}\right )+n^2 \lg n=O(n^2 \lg^2 n)$, where $T(n)$ is constant for $n \leq 8$, by using a method that requires choosing a specific function $f(n)$ and proving that for an appropriate $c>0$ and an appropriate $n_0 \in \mathbb{N}$, it stands that $T(n) \leq c f(n)$.
  • #1
evinda
Gold Member
MHB
3,836
0
Hello! (Wave)

I want to prove that $T(n)=4 T \left ( \frac{n}{2}\right )+n^2 \lg n=O(n^2 \lg^2 n)$,where $T(n)$ is constant for $n \leq 8$, using the following method:

"We choose a specific function $f(n)$ and we try to show that for an appropriate $c>0$ and an appropriate $n_0 \in \mathbb{N}$, it stands that $T(n) \leq c f(n)$.
We suppose that $T(k) \leq c f(k), \forall k<n$ and we try to show that it stands for $n$."

That's what I have tried:

We suppose that :
$$T(k) \leq c k^2 \lg^2 k, \forall k<n$$

$$T(n)=4 T \left ( \frac{n}{2}\right )+n^2 \lg n \leq 4c \left ( \frac{n}{2}\right )^2 \lg^2 \left ( \frac{n}{2}\right )+n^2 \lg n=cn^2 (\lg n-1)^2+n^2 \lg n=cn^2(\lg^2 n-2 \lg n+1)+n^2 \lg n \Rightarrow c \geq \frac{-\lg n}{1-2 \lg n} \to \frac{1}{2}$$

So, the relation stands $\forall c \geq \frac{1}{2}$.

Is it right or have I done something wrong? (Thinking)
 
Last edited:
Physics news on Phys.org
  • #2
evinda said:
Hello! (Wave)

I want to prove that $T(n)=4 T \left ( \frac{n}{2}\right )+n^2 \lg n=O(n^2 \lg^2 n)$,where $T(n)$ is constant for $n \leq 8$, using the following method:

"We choose a specific function $f(n)$ and we try to show that for an appropriate $c>0$ and an appropriate $n_0 \in \mathbb{N}$, it stands that $T(n) \leq c f(n)$.
We suppose that $T(k) \leq c f(k), \forall k<n$ and we try to show that it stands for $n$."

That's what I have tried:

We suppose that :
$$T(k) \leq c k^2 \lg^2 k, \forall k<n$$

$$T(n)=4 T \left ( \frac{n}{2}\right )+n^2 \lg n \leq 4c \left ( \frac{n}{2}\right )^2 \lg^2 \left ( \frac{n}{2}\right )+n^2 \lg n=cn^2 (\lg n-1)^2+n^2 \lg n=cn^2(\lg^2 n-2 \lg n+1)+n^2 \lg n \Rightarrow c \geq \frac{-\lg n}{1-2 \lg n} \to \frac{1}{2}$$

So, the relation stands $\forall c \geq \frac{1}{2}$.

Is it right or have I done something wrong? (Thinking)

Hi! (Smile)

It is right! (Nod)
 
  • #3
I like Serena said:
Hi! (Smile)

It is right! (Nod)

Nice! Thank you! (Clapping)
 

FAQ: Proving $T(n)=O(n^2 \lg^2 n)$ Using Recurrence Relation

What is a recurrence relation?

A recurrence relation is a mathematical equation that defines a sequence or set of numbers based on one or more previous terms in the sequence. It is used to model and analyze the time complexity of algorithms.

How can we prove that $T(n)=O(n^2 \lg^2 n)$ using a recurrence relation?

To prove that $T(n)=O(n^2 \lg^2 n)$ using a recurrence relation, we must show that the time complexity of the algorithm follows a polynomial function of the form $n^k$, where $k$ is a constant. We can do this by recursively breaking down the algorithm and analyzing the time complexity of each step, and then using mathematical induction to show that the overall time complexity is $O(n^2 \lg^2 n)$.

Why is it important to prove the time complexity of an algorithm using a recurrence relation?

Proving the time complexity of an algorithm using a recurrence relation allows us to analyze the efficiency and scalability of the algorithm. It helps us understand how the algorithm's performance will change as the input size increases, and allows us to compare different algorithms to determine which one is more efficient.

Can we use any recurrence relation to prove that $T(n)=O(n^2 \lg^2 n)$?

No, not all recurrence relations can be used to prove that $T(n)=O(n^2 \lg^2 n)$. The recurrence relation must accurately model the time complexity of the algorithm and follow the form of a polynomial function. If the recurrence relation does not meet these criteria, it cannot be used to prove the time complexity of the algorithm.

Are there any limitations to using a recurrence relation to prove time complexity?

Yes, there are some limitations to using a recurrence relation to prove time complexity. Firstly, it may not accurately reflect the actual time complexity of the algorithm in real-world scenarios. Additionally, it may be difficult to find an accurate recurrence relation for more complex algorithms. Finally, recurrence relations only provide an upper bound for the time complexity, and may not accurately reflect the best, average, or worst-case scenarios.

Similar threads

Back
Top