# Practice Set for Recurrence Relations

Prerequisite – Analysis of Algorithms | Set 1, Set 2, Set 3, Set 4, Set 5

**Que-1.** Solve the following recurrence relation?

T(n) = 7T(n/2) + 3n^2 + 2

(a) O(n^2.8)

(b) O(n^3)

(c) θ(n^2.8)

(d) θ(n^3)

**Explanation –**

T(n) = 7T(n/2) + 3n^2 + 2

As one can see from the formula above:

a = 7, b = 2, and f(n) = 3n^2 + 2

So, f(n) = O(n^c), where c = 2.

It falls in master’s theorem case 1:

logb(a) = log2(7) = 2.81 > 2

It follows from the first case of the master theorem that T(n) = θ(n^2.8) and implies O(n^2.8) as well as O(n^3).

Therefore, option (a), (b), and (c) are correct options.

**Que-2.** Sort the following functions in the decreasing order of their asymptotic (big-O) complexity:

f1(n) = n^√n , f2(n) = 2^n, f3(n) = (1.000001)^n , f4(n) = n^(10)*2^(n/2)

(a) f2> f4> f1> f3

(b) f2> f4> f3> f1

(c) f1> f2> f3> f4

(d) f2> f1> f4> f3

**Explanation –**

f2 > f4 because we can write f2(n) = 2^(n/2)*2^(n/2), f4(n) = n^(10)*2^(n/2) which clearly shows that f2 > f4

f4 > f3 because we can write f4(n) = n^10.〖√2〗^n = n10.(1.414)n , which clearly shows f4> f3

f3> f1:

f1 (n) = n^√n take log both side log f1 = √n log n

f3 (n) = (1.000001)^n take log both side log f3 = n log(1.000001), we can write as log f3 = √n*√n log(1.000001) and √n > log(1.000001).

So, correct order is f2> f4> f3> f1. Option (b) is correct.

**Que-3.** f(n) = 2^(2n)

Which of the following correctly represents the above function?

(a) O(2^n)

(b) Ω(2^n)

(c) Θ(2^n)

(d) None of these

**Explanation –** f(n) = 2^(2n) = 2^n*2^n

Option (a) says f(n)<= c*2n, which is not true.
Option (c) says c1*2n <= f(n) <= c2*2n, lower bound is satisfied but upper bound is not satisfied.
Option (b) says c*2n <= f(n) this condition is satisfied hence option (b) is correct.

**Que-4.** Master’s theorem can be applied on which of the following recurrence relation?

(a) T (n) = 2T (n/2) + 2^n

(b) T (n) = 2T (n/3) + sin(n)

(c) T (n) = T (n-2) + 2n^2 + 1

(d) None of these

**Explanation –** Master theorem can be applied to the recurrence relation of the following type

T (n) = aT(n/b) + f (n)

Option (a) is wrong because to apply master’s theorem, function f(n) should be polynomial.

Option (b) is wrong because in order to apply master theorem f(n) should be monotonically increasing function.

Option (c) is not the above mentioned type, therefore correct answer is (d).

**Que-5.** T(n) = 3T(n/2+ 47) + 2n^2 + 10*n – 1/2. T(n) will be

(a) O(n^2)

(b) O(n^(3/2))

(c) O(n log n)

(d) None of these

**Explanation –** For higher values of n, n/2 >> 47, so we can ignore 47, now T(n) will be

T(n) = 3T(n/2)+ 2*n^2 + 10*n – 1/2 = 3T(n/2)+ O(n^2)

Apply master theorem, it is case 2 of master theorem T(n) = O(n^2).

Option (a) is correct.

## Recommended Posts:

- Different types of recurrence relations and their solutions
- Discrete Mathematics | Types of Recurrence Relations - Set 2
- Mathematics | Closure of Relations and Equivalence Relations
- Discrete Mathematics | Representing Relations
- Number of possible Equivalence Relations on a finite set
- Mathematics | Introduction and types of Relations
- DBMS | Minimum relations satisfying 1NF
- Mathematics | Representations of Matrices and Graphs in Relations
- Practice questions on Strings
- Practice questions on B and B+ Trees
- Practice questions on Arrays
- Practice Problems on Hashing
- Analysis of Algorithms | Set 5 (Practice Problems)
- Practice problems on finite automata
- Algorithm Practice Question for Beginners | Set 1

This article is contributed by **Surendra Sharma**. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.