Solving Recurrence Relations: Are My Results Right?

In summary, the recurrence relations are:(a) T(n)=sqrt(2)*T(n/2)+lgn(b) T(n)=3*T(n/4)+nlgn(c) T(n) 3*T(n/3)+n/2(d) T(n)=5*T(n/2)+Θ(n)(e) T(n)=9*T(n/3)+O(n^2)
  • #1
mathmari
Gold Member
MHB
5,049
7
Helloo!
I have to solve the following recurrence relations:
(a) T(n)=sqrt(2)*T(n/2)+lgn
(b) T(n)=3*T(n/4)+nlgn
(c) T(n) 3*T(n/3)+n/2
(d) T(n)=5*T(n/2)+Θ(n)
(e) T(n)=9*T(n/3)+O(n^2)
Could you tell me if my results are right?
Using the master theorem I found:
(a)T(n)=Θ(sqrt(n))
(b)T(n)=Θ(nlgn)
(c)T(n)=Θ(nlgn)
(d)T(n)=Θ(n^(log(2)5)
(e)T(n)=Θ(n^2*lgn)
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
I agree with (a)–(d) using the version of the master theorem in http://www.csail.mit.edu/~thies/6.046-web/master.pdf from MIT, but not in Wikipedia. (The former document is given as a footnote in the Wiki article.) The reason is that Wikipedia uses only Θ and not O or Ω.

However, the theorem does not seem to apply to (e) because $f(n)=O(n^{\log_ba})$. Your answer would be correct by case 2 of the theorem if $f(n)=\Theta(n^{\log_ba})$.
 
  • #3
And how could I solve the recurrence relation (e)?
 
  • #4
mathmari said:
And how could I solve the recurrence relation (e)?
I am pretty sure there is an upper bound version of the master theorem, which says, in particular:

If $T(n) = aT(n/b) + f(n)$ where $f(n) = O(n^{\log_ba})$, then $T(n)=O(n^{\log_ba}\log n)$,

but I am having trouble finding exactly this formulation. http://www.eecis.udel.edu/~saunders/courses/621/11s/notes/notes/Master-theorem.html seems to say something pretty close. It also should be easy to change the proof from Θ to O.

If this is correct, then $T(n) = O(n^2\log n)$ in (e). I am not sure one can say more because if the last term is, in fact, $n^2$, then $T(n)=\Theta(n^2\log n)$, but if it is 0, then $T(n)=\Theta(n^2)$.
 
  • #5
Ok! Thanks!
 

FAQ: Solving Recurrence Relations: Are My Results Right?

How do I know if my solution to a recurrence relation is correct?

To determine if your solution to a recurrence relation is correct, you can use mathematical induction or substitution. If your solution satisfies the initial conditions and follows the recurrence relation, then it is considered correct.

What is the difference between a closed form and a recursive solution to a recurrence relation?

A closed form solution is an explicit formula that directly gives the value of a term in the sequence, while a recursive solution uses previous terms in the sequence to calculate the value of the current term.

Can I use a computer program to solve recurrence relations?

Yes, there are many computer programs and algorithms that can be used to solve recurrence relations. Some popular ones include the master theorem and dynamic programming.

Are there any common mistakes to avoid when solving recurrence relations?

Some common mistakes to avoid when solving recurrence relations include forgetting to satisfy the initial conditions, using the wrong base case, and not simplifying the solution enough.

How do I choose the best method for solving a recurrence relation?

The best method for solving a recurrence relation depends on the specific recurrence relation and its initial conditions. It is important to understand the properties and limitations of each method and choose the one that is most applicable to the given recurrence relation.

Similar threads

Replies
2
Views
969
Replies
18
Views
2K
Replies
2
Views
1K
Replies
1
Views
1K
Replies
1
Views
1K
Replies
5
Views
2K
Back
Top