Open In App

Practice Set for Recurrence Relations

Last Updated : 23 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

A recurrence relation is an equation that expresses each term of a sequence as a function of its preceding terms. In other words, it defines a sequence where each term depends on one or more of its previous terms. Recurrence relations commonly arise in divide-and-conquer algorithms, dynamic programming, and combinatorial problems.

Below are practice problems with solutions on recurrence relation.

Problem 1:

Solve the following recurrence relation?

7T(n/2​)+3n2+2

Options:
(a) O(n2.8)
(b) O(n3)
(c) θ(n2.8)
(d) θ(n3)

Correct answers: (a), (b), and (c)

Explanation:

  • a = 7, b = 2, f(n) = 3n2 + 2
  • c = 2 for f(n) = O(nc)
  • log⁡ba = log⁡27 ≈ 2.81 > 2
  • By Master Theorem case 1, T(n) = θ(n2.81)
  • This implies O(n2.8) and O(n3) as well.

Problem 2:

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

  • f1(n)=n√n
  • f2(n)=2n
  • f3(n)=(1.000001)n
  • f4(n)=n10⋅2n/2

Options:
(a) f2 > f4 > f1 > f3
(b) f2 > f4 > f3 > f1
(c) f1 > f2 > f3 > f4
(d) f2 > f1 > f4 > f3

Correct answer: (b) f2 > f4 > f3 > f1

Explanation:

  • f2 > f4 because 2n = 2n/2⋅2n/2 and f4 = n10⋅2n/2
  • f4 > f3 because f4=n10⋅(1.414)n and 1.414n grows faster than 1.000001n
  • f3 > f1 since log⁡ f3=nlog⁡(1.000001) grows faster than log⁡f1 = √nlog⁡n

Problem 3:

Given: f(n)=22n, which of the following correctly represents f(n)?

Options:
(a) O(2n)
(b) Ω(2n)
(c) Θ(2n)
(d) None of these

Correct answer: (b) Ω(2n)

Explanation:

  • 22n = (2n)2
  • f(n) grows faster than 2n
  • f(n) ≥ c⋅2nf(n) some c, so Ω(2n) holds.
  • O(2n) and Θ(2n) do not hold because f(n) grows faster.

Problem 4:

Master’s theorem can be applied on which of the following recurrence relations?

Options:
(a) T(n) = 2T(n/2) + 2n
(b) T(n) = 2T(n/3) + sin⁡(n)
(c) T(n) = T(n − 2) + 2n2 + 1
(d) None of these

Correct answer: (d) None of these

Explanation:

  • Master theorem applies to recurrences of form T(n) = aT(n/b) + f(n) where f(n) is polynomial or monotonic.
  • (a) is invalid because f(n) = 2n is exponential, not polynomial.
  • (b) is invalid because sin⁡(n) is not monotonic.
  • (c) is a decreasing function recurrence (not dividing), so Master theorem does not apply here in the usual form.

Problem 5:

Given: T(n) = 3T(n/2 +47) + 2n2 + 10n − 1/2
What is the order of T(n)?

Options:
(a) O(n2)
(b) O(n3/2)
(c) O(nlog⁡n)
(d) None of these

Correct answer: (a) O(n2)

Explanation:

  • For large n, n/2 + 47 ≈ n/2
  • So, T(n) ≈ 3T(n/2) + O(n2)
  • By Master theorem: a = 3, b = 2, f(n) = O(n2)
  • log⁡23 ≈ 1.58 < 2, so case 3 applies.
  • T(n) = O(n2)

Read in detail about Recurrence Relation here.


Practice Tags :

Similar Reads