Solve the following recurrence relations. Do not use the master method. Show all of your work

Question

Recurrence Relation practice solve the following recurrence relations. Do not use the master method. Show all of your work.

    1. T(n)=2T(n-1)+c2n
    2. T(n)=7T(n/2)+c2n
    3. T(n)=2T(n/2)+n2
    4. T(n)=5T(n/4)+n1/2

Summary

The solution of the following recurrence relations is:

    1.  O(n2n)
    2.  O(n3)
    3.  O(n2)
    4.  O(n)

 

Explanation

1). T(n)=2T(n-1)+c2n

Using recursion function

Total cost=2n+2n+2n+2n………………..+2n

                          =2n*n terms

T(n)=2T(n-1)+c2n= O(n. 2n)

2). T(n)=7T(n/2)+c2n

Total cost=n2*(8/4)logn2<=n2*2logn2

= n2*n

= O(n3)

3). T(n)=2T(n/2)+n2

  

Total cost=n2(2-2/T)

= 2 n2-2n

= O(n3)

4). T(n)=5T(n/4)+n1/2

Total cost= n1/2 ((2)logn4+1-1)

= n1/2(4logn1/2-1)

= n1/2(4n1/2-1)

= 4n- n1/2

= O(n)

 

Also, read the Given below-defined UML class diagram.

 

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *