I think the Master Theorem can be applied in this problem. It is much easier to understand than recurrence tree.
Write the recurrence formula in another form. Add T(n/2)
to both the left and right side.
T(n) + T(n/2) = + 2T(n/4) + 2T(n/2) + n2
T(n) + T(n/2) = + 2[ T(n/4) + T(n/2) ] + n2
Define G(n) = T(n) + T(n/2)
, then
G(1) = Θ(1)
G(n) = 2G(n/2) + n2, if n > 1
Apply the Master Theorem to the above new recurrence formula
G(n) = Θ(n2)
that is
T(n) + T(n/2) = Θ(n2)
for n > 1
T(n) = 2 * T(n/4) + T(n/2) + n2
= T(n/4) + [ T(n/2) + T(n/4) ] + n2
= T(n/4) + Θ(n2/4) + n2
= T(n/4) + Θ(n2)
Apply the Master Theorem to the above new recurrence formula
T(n) = Θ(n2)