Consider the following recurrence relation.
Which one of the following options is correct?
View worked solution
Answer: C
We can solve this recurrence relation using the recursion tree method.
Let us analyze the cost at each level of the recursion tree:
- Level 0:
- Level 1:
- Level 2:
- Level :
The total cost is the sum of the costs at all levels. Since the work at each level decreases geometrically, we can upper-bound the total cost by an infinite geometric series:
Since the root level alone contributes , we also have . Therefore, we get:
Thus, the correct option is C.
Free practice · Your answers on this page are not saved.
