What is the value of following recurrence? T(n) = T(n/4) + T(n/2) + cn2 T(1) = c T(0) = 0 Where c is a…
The recurrence solves to \(O(n^2)\). In the recursion tree, the root contributes \(cn^2\), the next level contributes \(c(n/4)^2 + c(n/2)^2\) \(= \frac{5}{16}cn^2\), and…
Choose your answer
What is the value of following recurrence?
T(n) = T(n/4) + T(n/2) + cn2
T(1) = c
T(0) = 0
Where c is a positive constant
Answer and explanation
Correct answer B
The recurrence solves to . In the recursion tree, the root contributes , the next level contributes , and level contributes at most . Since this is a decreasing geometric series with ratio , the total work is bounded by .
Practice for these exams
-
Jammu & Kashmir and Ladakh SET (JKSET/LASET)