Recurrence Relation · Algorithms
24 questions · asked in 15 of 27 years (2000–2026)
MCQ 22 · MSQ 1 · NAT 11-mark 15 · 2-mark 9
2000Questions per year2026
Questions 16–20 of 24
Let denote the number of binary strings of length n that contain no consecutive 0s.
Which of the following recurrences does satisfy?
Which of the following recurrences does satisfy?
Answer: (D)
List the valid strings for each length. The count is written after the dash.
So . The reason: split the valid strings of length by their last bit.
- A string ending in can have any valid string of length in front of it. That gives strings.
- A string ending in must have just before that , so it ends in . In front of the can be any valid string of length . That gives strings.
The counts follow this rule, so .
The other options fail: (A) would give , but . (B) would give , but . (C) would give , but .
Answer: (D)
So . The reason: split the valid strings of length by their last bit.
- A string ending in can have any valid string of length in front of it. That gives strings.
- A string ending in must have just before that , so it ends in . In front of the can be any valid string of length . That gives strings.
The counts follow this rule, so .
The other options fail: (A) would give , but . (B) would give , but . (C) would give , but .
Answer: (D)
Consider the following recurrence:
T(n)=2T()+ 1, T(1) = 1
Which one of the following is true?
T(n)=2T()+ 1, T(1) = 1
Which one of the following is true?
Answer: (B)
Put and define . Then the recurrence becomes: .
Going back to n, we get .
Final answer:
Going back to n, we get .
Final answer:
Let T(n) be a function defined by the recurrence
and
Which of the following statements is TRUE?
and
Which of the following statements is TRUE?
Answer: (C)
Use the Master theorem with and .
First, find this value: .
The given function is .
So holds for any real with . This means Case 1 of the Master theorem is satisfied.
So .
Answer: (C)
First, find this value: .
The given function is .
So holds for any real with . This means Case 1 of the Master theorem is satisfied.
So .
Answer: (C)
Suppose T(0)=T(1)=1
Which one of the following is FALSE?
Which one of the following is FALSE?
Answer: (C)
Use the Master theorem with , and .
Here , which is the same as . This is case 2, so .
Now check each option:
- (A) . True.
- (B) . True.
- (C) would need to grow at least as fast as . It does not, since . False.
- (D) . True.
So the false statement is (C).
Answer: (C)
Here , which is the same as . This is case 2, so .
Now check each option:
- (A) . True.
- (B) . True.
- (C) would need to grow at least as fast as . It does not, since . False.
- (D) . True.
So the false statement is (C).
Answer: (C)
Consider a list of recursive algorithms and a list of recurrence relations as shown below. Each recurrence relation corresponds to exactly one algorithm and is used to derive the time complexity of the algorithm.
Which of the following is the correct match between the algorithms and their recurrence relations?
Which of the following is the correct match between the algorithms and their recurrence relations?
Answer: (B)
Write the recurrence of each algorithm.
- Binary search (P): one comparison, , then we keep one half of elements and discard the other half. So , which is IV.
- Merge sort (Q): divide the array into two parts of elements, sort each recursively, then merge the two sorted halves in time. So , which is III.
- Quick sort (R): time to partition around the pivot, then two recursive calls on the two parts. The two parts have about and elements. So , which is I.
- Tower of Hanoi (S) with disks: move the top disks to the spare peg, move the largest disk (one move), then move the disks onto it. The problem of size is solved twice, so , which is II.
The match is P-IV, Q-III, R-I, S-II.
Answer: (B)
- Binary search (P): one comparison, , then we keep one half of elements and discard the other half. So , which is IV.
- Merge sort (Q): divide the array into two parts of elements, sort each recursively, then merge the two sorted halves in time. So , which is III.
- Quick sort (R): time to partition around the pivot, then two recursive calls on the two parts. The two parts have about and elements. So , which is I.
- Tower of Hanoi (S) with disks: move the top disks to the spare peg, move the largest disk (one move), then move the disks onto it. The problem of size is solved twice, so , which is II.
The match is P-IV, Q-III, R-I, S-II.
Answer: (B)
Keep practising