MHB Solving T(n) = O(n lg n) using substitution method?

  • Thread starter Thread starter evinda
  • Start date Start date
Click For Summary
SUMMARY

The recursive relation $T(n)=2T(\lfloor \frac{n}{2} \rfloor +17)+n$ is shown to be $O(n \lg n)$ using the substitution method. The analysis begins with the assumption that $T(n)=O(n \lg n)$ and establishes a base case for $n \geq 33$. The discussion highlights the limitations of applying the Master Theorem due to the additional constant in the recursion and suggests the Akra–Bazzi method as a more advanced alternative. Ultimately, the conclusion emphasizes the necessity of careful handling of the recursive terms to avoid contradictions.

PREREQUISITES
  • Understanding of recursive relations and their analysis
  • Familiarity with Big O notation, specifically $O(n \lg n)$
  • Knowledge of the substitution method for solving recurrences
  • Basic concepts of the Master Theorem and the Akra–Bazzi method
NEXT STEPS
  • Study the Akra–Bazzi method for solving complex recurrences
  • Learn about the Master Theorem and its applications in algorithm analysis
  • Practice solving recursive relations using the substitution method
  • Explore examples of $O(n \lg n)$ algorithms to understand their behavior
USEFUL FOR

Students and educators in computer science, particularly those focusing on algorithm analysis, recursion, and complexity theory. This discussion is beneficial for anyone looking to deepen their understanding of solving recursive relations.

evinda
Gold Member
MHB
Messages
3,741
Reaction score
0
Hello! :-)

I am looking at the following exercise:
Show that the solution of the recursive relation $T(n)=2T( \lfloor \frac{n}{2} \rfloor +17)+n$ is $O(n \lg{n})$.

So,we suppose that $T(n)=O(n \lg n)$.

In order the recursive relation to be well-defined,I thought to use the inequality $\lfloor x \rfloor \geq x-1$ and I found:

$$ \lfloor \frac{n}{2} \rfloor+17 \leq n \Rightarrow n \geq \lfloor \frac{n}{2} \rfloor +17> \frac{n}{2}-1+17 \Rightarrow n>\frac{n}{2}+16 \Rightarrow n\geq 33$$

$$\text{ So, } n_0=33$$

As $T(n)=O(n \lg n)$,we suppose that $\exists c,b>0 \text{ such that } \forall n \geq 33 : T(n) \leq c(n-b) \lg n$We suppose that the relation stands also for $\lfloor \frac{n}{2} \rfloor+17$,then: $T(\lfloor{\frac{n}{2}} \rfloor+17) \leq c(\lfloor \frac{n}{2} \rfloor +17-b) \lg (\lfloor \frac{n}{2} \rfloor+17)$

$$T(n)\leq 2c(\lfloor \frac{n}{2} \rfloor+17-b) \lg ( \lfloor \frac{n}{2} \rfloor +17)+n \leq 2c (\frac{n}{2}+17-b) \lg n+n = c(n-b+(34-b)) \lg n +n \leq c(n-b) \lg n +n,\text{ if } 34 \leq b$$

We also know that it must be $ T(n)\geq 0 \Rightarrow n \geq b \Rightarrow b\leq n, \forall n \geq n_0 \Rightarrow b\leq n_0 \Rightarrow b \leq 33$

So,we have a contradiction..Also,even if it was not a contadiction,we couldn't do it in this way,because: $c(n-b) \lg n +n \geq c(n-b) \lg n$

But..how can we show it then? (Thinking)
 
Last edited:
Technology news on Phys.org
evinda said:
I am looking at the following exercise:
Show that the solution of the recursive relation $T(n)=2T( \lfloor \frac{n}{2} \rfloor +17)+n$ is $O(n \lg{n})$.

So,we suppose that $T(n)=O(n \lg n)$.
Do you always assume what you need to show?

evinda said:
As $T(n)=O(n \lg n)$,we suppose that $\exists c,b>0 \text{ such that } \forall n \geq 33 : T(n) \leq c(n-b) \lg n$
Why not $T(n) \leq cn\lg n$?

This problem would be covered by the master theorem (case 2) if it were not for $+17$. It is covered by the Akra–Bazzi method, which is a generalization of the master theorem. In the notations of the Wiki page, $g(x)=x$, $k=1$, $a=2$, $b=1/2$ and $h(x)=17+\lfloor n/2\rfloor-n/2$. However, this theorem is more advanced and may not be covered in some courses dealing with recurrence relations.

What is the context of this problem? Where in the course or book are you? What methods are you supposed to solve it?
 
Evgeny.Makarov said:
Do you always assume what you need to show?

I saw at the solution of a similar exercise that they did it like that.. So is it wrong? (Thinking)(Worried)

Evgeny.Makarov said:
Why not $T(n) \leq cn\lg n$?

I have also tried it,supposing $T(n) \leq cn\lg n$,then I supposed that the relation also stands for $\lfloor \frac{n}{2} \rfloor +17: T(\frac{n}{2} \rfloor +17) \leq c( \lfloor \frac{n}{2} \rfloor +17) \lg (\lfloor \frac{n}{2} \rfloor+17)$

So:

$$T(n) \leq 2c(\lfloor \frac{n}{2} \rfloor+17) \lg (\lfloor \frac{n}{2} \rfloor+17)+n \leq 2c(\lfloor \frac{n}{2} \rfloor+17) \lg n+n \leq 2c(\frac{n}{2}+17) \lg n+n \leq c(n+34) \lg n +n$$
Evgeny.Makarov said:
This problem would be covered by the master theorem (case 2) if it were not for $+17$. It is covered by the Akra–Bazzi method, which is a generalization of the master theorem. In the notations of the Wiki page, $g(x)=x$, $k=1$, $a=2$, $b=1/2$ and $h(x)=17+\lfloor n/2\rfloor-n/2$. However, this theorem is more advanced and may not be covered in some courses dealing with recurrence relations.

What is the context of this problem? Where in the course or book are you? What methods are you supposed to solve it?

I haven't seen the Master theorem yet..I am supposed to solve it,using the substitution method.. (Worried)
 
We have many threads on AI, which are mostly AI/LLM, e.g,. ChatGPT, Claude, etc. It is important to draw a distinction between AI/LLM and AI/ML/DL, where ML - Machine Learning and DL = Deep Learning. AI is a broad technology; the AI/ML/DL is being developed to handle large data sets, and even seemingly disparate datasets to rapidly evaluated the data and determine the quantitative relationships in order to understand what those relationships (about the variaboles) mean. At the Harvard &...

Similar threads

Replies
59
Views
8K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K