Site navigation

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

Select one answer
Answer and explanation

Correct answer B

The recurrence solves to O(n2)O(n^2). In the recursion tree, the root contributes cn2cn^2, the next level contributes c(n/4)2+c(n/2)2c(n/4)^2 + c(n/2)^2 =516cn2= \frac{5}{16}cn^2, and level kk contributes at most (516)kcn2\left(\frac{5}{16}\right)^k cn^2. Since this is a decreasing geometric series with ratio 5/16<15/16 < 1, the total work is bounded by cn2∑k=0∞(5/16)kcn^2 \sum_{k=0}^{\infty} (5/16)^k =1611cn2= \frac{16}{11}cn^2 =O(n2)= O(n^2).

Practice for these exams

  • Jammu & Kashmir and Ladakh SET (JKSET/LASET)

Related question papers

Related exam syllabi

Related questions in this topic