
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Practice Set for Recurrence Relations
Recurrence relations are equations that recursively defines a multidimensional array.
Here we will solve so questions based on recurrence relations.
Solve the recurrence reation:T(n) = 12T(n/2) + 9n2 + 2. T(n) = 12T(n/2) + 9n2 + 2. Here, a = 12 and b = 2 and f(n) = 9(n)2 + 2 It is of the form f(n) = O(n^c), where c = 2
This form its in the master’s theorem condition,
So, logb(a) = log2(12) = 3.58 Using case 1 of the masters theorm, T(n) = θ(n3.58).
Solve the recurrence reation:T(n) = 5T(n/2 + 23) + 5n2 + 7n - 5/3. T(n) = 5T(n/2 + 23) + 5n2 + 7n - 5/3
On simplification, in case of large values, n,n/2 >> 23, so 23 is neglected.
T(n) = 5T(n/2) + 5n2 + 7n - 5/3. Further, we can take 5n2 + 7n - 5 ?0(n2). So, T(n) = 5T(n/2) + O(n2)
This fall under the case 2 of masters theorem,
So, T(n) = O(n2).
Check if the following comes under any case of a master’s theorem.
T(n) = 2T(n/3) + 5n
No, For masters theorem to be applied, the function should be a polynomial function.
T(n) = 2T(n/5) + tan(n)
No, trignometric function do not come under masters theorem.
T(n) = 5T(n+1) + log(n)
No, Logarithmic function do not come under masters theorem.
T(n) = T(n-7) + en
No, exponential function do not come under masters theorem.
T(n) = 9n(n/2+1 ) + 4(n2) - 17 Yes, as solved above.
Advertisements