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 21–24 of 24
The recurrence equation
T(1) = 1
T(n) = 2T(n - 1) + n, n 2
evaluates to
T(1) = 1
T(n) = 2T(n - 1) + n, n 2
evaluates to
Answer: (A)
Unroll the recurrence :
Continue down to . This gives
Group the terms:
, where .
The first sum is a GP: .
To find , write and subtract from it. The coefficient of becomes for , and for :
.
Put in the sums:
Check: and . Option (C) would give 2 and option (D) would give 6.
Answer: (A)
Continue down to . This gives
Group the terms:
, where .
The first sum is a GP: .
To find , write and subtract from it. The coefficient of becomes for , and for :
.
Put in the sums:
Check: and . Option (C) would give 2 and option (D) would give 6.
Answer: (A)
Consider the following recurrence relation
T(1)=1
T(n+1)=T(n)+ for all n 1
The value of T( ) for m 1 is
T(1)=1
T(n+1)=T(n)+ for all n 1
The value of T( ) for m 1 is
Answer: (B)
Since , unrolling the recurrence gives .
The value of is for , which is numbers. For example, give 1 (three numbers), and give 2 (five numbers). The last number gives once. So
.
Using and :
.
Check with : , and (B) gives . (A) gives 59 and (D) gives 297.5.
Answer: (B)
The value of is for , which is numbers. For example, give 1 (three numbers), and give 2 (five numbers). The last number gives once. So
.
Using and :
.
Check with : , and (B) gives . (A) gives 59 and (D) gives 297.5.
Answer: (B)
The running time of the following algorithm
Procedure A(n)
If n 2 return (1) else return (A());
is best discribed by
Procedure A(n)
If n 2 return (1) else return (A());
is best discribed by
Answer: (C)
The running time is the number of recursive calls. This equals the number of times we can take the square root of n again and again, until n becomes .
So,
Answer : Option C
The solution to the recurrence equation is
Answer: (B)
Let . Then .
Use case 1 of the Master theorem with and , since for some .
So .
This is not , so (A) is out, and (B) is the only option of order .
We can also solve it exactly by unrolling:
The recursion depth is . The bracket is a GP with first term and ratio , and it has terms, so its sum is . With :
Check: gives and .
Answer: (B)
Use case 1 of the Master theorem with and , since for some .
So .
This is not , so (A) is out, and (B) is the only option of order .
We can also solve it exactly by unrolling:
The recursion depth is . The bracket is a GP with first term and ratio , and it has terms, so its sum is . With :
Check: gives and .
Answer: (B)
Keep practising