Recurrence Relations MCQ Quiz - Objective Question with Answer for Recurrence Relations - Download Free PDF
Last updated on Apr 11, 2025
Latest Recurrence Relations MCQ Objective Questions
Recurrence Relations Question 1:
Which of the following is the solution of the following recurrence relation T(n) = T(2n/3) + 1?
Answer (Detailed Solution Below)
Recurrence Relations Question 1 Detailed Solution
The correct answer is : option 2.
Key Points
Explanation of the Recurrence Relation Solution
Given the recurrence relation: T(n) = T(2n/3) + 1
To solve this, we will use the Master Theorem for divide-and-conquer recurrences of the form:
T(n) = aT(n/b) + f(n)
In our case, a = 1
, b = 3/2
, and f(n) = 1
.
Using the Master Theorem, we compare f(n)
with n^log_b(a)
:
a = 1
b = 3/2
log_b(a) = log(1) / log(3/2) = 0
f(n) = 1
Since f(n) = 1
is Θ(1)
, it matches the case where f(n) = Θ(n^c)
with c = 0
. This corresponds to case 2 of the Master Theorem, where f(n)
is polynomially smaller than n^log_b(a)
.
Therefore, the solution to the recurrence is:
T(n) = Θ(log n)
Thus, the correct answer is option 2.
Recurrence Relations Question 2:
An explicit formula for the sequence defined by the recurrence relation bn = 2bn-1 + 1, with the initial condition b1 = 7 is:
Answer (Detailed Solution Below)
Recurrence Relations Question 2 Detailed Solution
Given:
Recurrence Relation:- bn = 2bn-1 + 1
Initial Condition b1 = 7
Formula Used:
\(\frac{1 - x^{m + 1}}{1 - x} = 1 + x + x^2 + .... + x^m\)
Calculation:
We have.
⇒ bn = 2bn - 1 + 1
⇒ bn - 1 = 2bn - 2 + 1
⇒ bn - 2 = 2bn - 3 + 1
⇒ bn - 3 = 2bn - 4 + 1
and so on.... b1 = 7
Thus bn = 2[2bn - 2 + 1] + 1
⇒ bn = 22bn - 2 + 2 + 1
⇒ bn = 22[2bn - 3 + 1] + 2 + 1
⇒ bn = 23bn - 3 + 22 + 2 + 1
⇒ bn = 24bn - 4 + 23 + 22 + 2 + 1
⇒ bn = 2n - 1b1 + [2n - 2 + 2n - 3 + ... + 23 + 22 + 2 + 1]
⇒ bn = 2n - 1b1 + \(\left( \frac{ 1 - 2^{n - 2 + 1}}{1 - 2} \right) \)
⇒ bn = 2n - 1b1 + (2n - 1 - 1)
⇒ bn = 2n - 1(7) + (2n - 1 - 1) [Putting b1 = 7]
⇒ bn = 2n - 1(7 + 1) - 1
⇒ bn = 2n - 1 (23) - 1
⇒ bn = 2n + 2 - 1
∴ The explicit formula for the given sequence is bn = 2n + 2 - 1
Recurrence Relations Question 3:
The difference equation Pn + 1 = aPn + b. Then calculate P2 if P0 = 2, a = 3, and b = -1.
Answer (Detailed Solution Below)
Recurrence Relations Question 3 Detailed Solution
Solution:
Pn + 1 = aPn + b
given, a = 3 and b = -1
Pn+1 = 3Pn - 1 . . .(i)
Put n=0
P1 = 3 P0 - 1 = 6-1 = 5
Put n = 1 in equation (i)
P2 = 3P2 - 1 = 15-1 = 14
Hence, P2 is 14.
Recurrence Relations Question 4:
If the recurrence relation capturing the optimal execution time of the towers of Hanoi problem with n discs is T(n) = 2T(n - 1) + 1 then what is the value of T(8)?
Answer (Detailed Solution Below)
Recurrence Relations Question 4 Detailed Solution
Although base condition is not mentioned for tower of Hanoi when number disc is 0, that is, n = 0
number of moves needed is 0.
T(0) = 0 (base condition for Tower of Hanoi)
T(1) = 2 × T(0) + 1 = 0 + 1 = 1
T(2) = 2 × T(1) + 1 = 2 + 1 = 3
T(3) = 2 × T(2) + 1 = 6 + 1 = 7
T(4) = 2 × T(3) + 1 = 14 + 1 = 15
T(5) = 2 × T(4) + 1 = 30 + 1 = 31
T(6) = 2 × T(5) + 1 = 62 + 1 = 63
T(7) = 2 × T(6) + 1 = 126 + 1 = 127
T(8) = 2 × T(7) + 1 = 254 + 1 = 255
Tips and Tricks:
Number of moves required for n disc in a Tower of Hanoi is 2n – 1 = 28 – 1 = 255.
Recurrence Relations Question 5:
Let an be the number of n-bit strings that do NOT contain two consecutive 1s. Which one of the following is the recurrence relation for an?
Answer (Detailed Solution Below)
Recurrence Relations Question 5 Detailed Solution
We have to take n-bit strings that do not contain two consecutive 1’s
For n = 1, i.e. 1 bit string , number of strings with 1 bit = { 0, 1 } = 2
For n = 2 i.e. 2 bit string, number of strings with 2 bit = {00, 01, 10} = 3
For n = 3, i.e. 3 bit string, number of strings with 3 bit = {000, 001, 010, 100, 101} = 5
For n = 4 i.e. 4 bit string, number of strings with 4 bit = {0000, 0001, 0010, 0100, 1000, 0101, 1010, 1001} = 8
Here, these values are making a Fibonacci series. Because we are getting the next value by adding the previous two values like in Fibonacci sequence (0, 1, 1, 2, 3, 5, 8 ……..)
Recurrence relation for Fibonacci sequence is : T(n) = T (n -1 ) + T(n - 2)
So, here recurrence relation for an = an-1 + an-2Top Recurrence Relations MCQ Objective Questions
Let an be the number of n-bit strings that do NOT contain two consecutive 1s. Which one of the following is the recurrence relation for an?
Answer (Detailed Solution Below)
Recurrence Relations Question 6 Detailed Solution
Download Solution PDFWe have to take n-bit strings that do not contain two consecutive 1’s
For n = 1, i.e. 1 bit string , number of strings with 1 bit = { 0, 1 } = 2
For n = 2 i.e. 2 bit string, number of strings with 2 bit = {00, 01, 10} = 3
For n = 3, i.e. 3 bit string, number of strings with 3 bit = {000, 001, 010, 100, 101} = 5
For n = 4 i.e. 4 bit string, number of strings with 4 bit = {0000, 0001, 0010, 0100, 1000, 0101, 1010, 1001} = 8
Here, these values are making a Fibonacci series. Because we are getting the next value by adding the previous two values like in Fibonacci sequence (0, 1, 1, 2, 3, 5, 8 ……..)
Recurrence relation for Fibonacci sequence is : T(n) = T (n -1 ) + T(n - 2)
So, here recurrence relation for an = an-1 + an-2Which of the following is the solution of the following recurrence relation T(n) = T(2n/3) + 1?
Answer (Detailed Solution Below)
Recurrence Relations Question 7 Detailed Solution
Download Solution PDFThe correct answer is : option 2.
Key Points
Explanation of the Recurrence Relation Solution
Given the recurrence relation: T(n) = T(2n/3) + 1
To solve this, we will use the Master Theorem for divide-and-conquer recurrences of the form:
T(n) = aT(n/b) + f(n)
In our case, a = 1
, b = 3/2
, and f(n) = 1
.
Using the Master Theorem, we compare f(n)
with n^log_b(a)
:
a = 1
b = 3/2
log_b(a) = log(1) / log(3/2) = 0
f(n) = 1
Since f(n) = 1
is Θ(1)
, it matches the case where f(n) = Θ(n^c)
with c = 0
. This corresponds to case 2 of the Master Theorem, where f(n)
is polynomially smaller than n^log_b(a)
.
Therefore, the solution to the recurrence is:
T(n) = Θ(log n)
Thus, the correct answer is option 2.
An explicit formula for the sequence defined by the recurrence relation bn = 2bn-1 + 1, with the initial condition b1 = 7 is:
Answer (Detailed Solution Below)
Recurrence Relations Question 8 Detailed Solution
Download Solution PDFGiven:
Recurrence Relation:- bn = 2bn-1 + 1
Initial Condition b1 = 7
Formula Used:
\(\frac{1 - x^{m + 1}}{1 - x} = 1 + x + x^2 + .... + x^m\)
Calculation:
We have.
⇒ bn = 2bn - 1 + 1
⇒ bn - 1 = 2bn - 2 + 1
⇒ bn - 2 = 2bn - 3 + 1
⇒ bn - 3 = 2bn - 4 + 1
and so on.... b1 = 7
Thus bn = 2[2bn - 2 + 1] + 1
⇒ bn = 22bn - 2 + 2 + 1
⇒ bn = 22[2bn - 3 + 1] + 2 + 1
⇒ bn = 23bn - 3 + 22 + 2 + 1
⇒ bn = 24bn - 4 + 23 + 22 + 2 + 1
⇒ bn = 2n - 1b1 + [2n - 2 + 2n - 3 + ... + 23 + 22 + 2 + 1]
⇒ bn = 2n - 1b1 + \(\left( \frac{ 1 - 2^{n - 2 + 1}}{1 - 2} \right) \)
⇒ bn = 2n - 1b1 + (2n - 1 - 1)
⇒ bn = 2n - 1(7) + (2n - 1 - 1) [Putting b1 = 7]
⇒ bn = 2n - 1(7 + 1) - 1
⇒ bn = 2n - 1 (23) - 1
⇒ bn = 2n + 2 - 1
∴ The explicit formula for the given sequence is bn = 2n + 2 - 1
Consider the recurrence equation
\(T(n)= 2T(n-1)\ if \ n>0\)
= \(1 \ otherwise\)
Then T(n) is (in big O order)
Answer (Detailed Solution Below)
Recurrence Relations Question 9 Detailed Solution
Download Solution PDFT(n)=2T(n−1)
T(n)= 2[2T(n−2)] = 22T(n−2)
T(n)=22 [2T(n−3)]=23T(n−3)
T(n)=2kT(n−k)
n−k=0, n=k, T(0)=1
T(n)= O(2n)
Recurrence Relations Question 10:
If the recurrence relation capturing the optimal execution time of the towers of Hanoi problem with n discs is T(n) = 2T(n - 1) + 1 then what is the value of T(8)?
Answer (Detailed Solution Below)
Recurrence Relations Question 10 Detailed Solution
Although base condition is not mentioned for tower of Hanoi when number disc is 0, that is, n = 0
number of moves needed is 0.
T(0) = 0 (base condition for Tower of Hanoi)
T(1) = 2 × T(0) + 1 = 0 + 1 = 1
T(2) = 2 × T(1) + 1 = 2 + 1 = 3
T(3) = 2 × T(2) + 1 = 6 + 1 = 7
T(4) = 2 × T(3) + 1 = 14 + 1 = 15
T(5) = 2 × T(4) + 1 = 30 + 1 = 31
T(6) = 2 × T(5) + 1 = 62 + 1 = 63
T(7) = 2 × T(6) + 1 = 126 + 1 = 127
T(8) = 2 × T(7) + 1 = 254 + 1 = 255
Tips and Tricks:
Number of moves required for n disc in a Tower of Hanoi is 2n – 1 = 28 – 1 = 255.
Recurrence Relations Question 11:
The difference equation Pn + 1 = aPn + b. Then calculate P2 if P0 = 2, a = 3, and b = -1.
Answer (Detailed Solution Below)
Recurrence Relations Question 11 Detailed Solution
Solution:
Pn + 1 = aPn + b
given, a = 3 and b = -1
Pn+1 = 3Pn - 1 . . .(i)
Put n=0
P1 = 3 P0 - 1 = 6-1 = 5
Put n = 1 in equation (i)
P2 = 3P2 - 1 = 15-1 = 14
Hence, P2 is 14.
Recurrence Relations Question 12:
The solution to the recurrence relation T(n) = T(n - 1) + n, T(0) = 2 is
Answer (Detailed Solution Below)
Recurrence Relations Question 12 Detailed Solution
a1 = a0 + 1
a2 = a1 + 2
= a0 + 1 + 2
an = a0 + 1 + 2 + ……… + n
\(= 2 + \;\frac{{n\left( {n\; + \;1} \right)}}{2}\)
\({a_n} = \frac{{{n^2}\; + \;n\; + \;4}}{2}\)
Recurrence Relations Question 13:
Let an be the number of n-bit strings that do NOT contain two consecutive 1s. Which one of the following is the recurrence relation for an?
Answer (Detailed Solution Below)
Recurrence Relations Question 13 Detailed Solution
We have to take n-bit strings that do not contain two consecutive 1’s
For n = 1, i.e. 1 bit string , number of strings with 1 bit = { 0, 1 } = 2
For n = 2 i.e. 2 bit string, number of strings with 2 bit = {00, 01, 10} = 3
For n = 3, i.e. 3 bit string, number of strings with 3 bit = {000, 001, 010, 100, 101} = 5
For n = 4 i.e. 4 bit string, number of strings with 4 bit = {0000, 0001, 0010, 0100, 1000, 0101, 1010, 1001} = 8
Here, these values are making a Fibonacci series. Because we are getting the next value by adding the previous two values like in Fibonacci sequence (0, 1, 1, 2, 3, 5, 8 ……..)
Recurrence relation for Fibonacci sequence is : T(n) = T (n -1 ) + T(n - 2)
So, here recurrence relation for an = an-1 + an-2Recurrence Relations Question 14:
The solution of recurrence relationan = 6an-2 - an-1 is _____ where a0 = 2 and a1 = 9.
Answer (Detailed Solution Below)
Recurrence Relations Question 14 Detailed Solution
Characteristic equation of recurrence relation an = 6an-2 - an-1 is
r2 = 6 - r
r2 + r - 6 = 0
(r - 2) (r + 3) = 0
∴ r = 2 or r = -3
The solution of recurrence relationan = 6 an-2 - an-1 is
αn = α1(2)n + α2(-3)n
Using α0 = 2
α0 = α1(2)0 + α2(-3)0 = 2
∴ α1 + α2 = 2 ....(1)
Using α1 = 9
α1 = α1(2)1+ α2(-3)1 = 9
∴ 2α1 - 3α2 = 9 ....(2)
By solving (1) and (2)
α1 = 3 and α2 = - 1
The solution of recurrence relation
Recurrence Relations Question 15:
What could be the solution for the equation T (n) = 10 T(n-1) – 25 T(n-2), if T(0) = T(1) = 5
Answer (Detailed Solution Below)
Recurrence Relations Question 15 Detailed Solution
T (n) = 10 T(n-1) – 25 T(n-2)
We can write it as :
T(n) – 10 T(n-1) + 25 T(n-2) = 0
Then in polynomial form, it can be represented as :
x2 – 10x + 25 = 0
(x - 5)2 = 0
Then the characteristic equation will be :
T(n ) = C15n + C2.n.5n
T(0) = T(1) = 5
So, T(0) = C150 + C2.0.50
5 = C1
Now, T(1) = C1 51 + C21.51
5 = 5C1+ 5C2
i.e. C1 + C2 = 1
C2 = -4
So, T(n) = 5.5n + (-4)n.5n
= 5n+1 – 4n5n