Lecture 04: Practice Problems

1. Master Theorem Practice

T(n) = 2T(n/4) + sqrt(n)

Show Answer

a=2, b=4. log_4 2 = 0.5.

n^0.5 vs f(n) = n^0.5.

They are equal. Case 2.

Answer: Theta(sqrt(n) * log n) or Theta(n^0.5 log n).

2. Recursion Tree Shape

If T(n) = T(n/3) + T(2n/3) + n, is the tree depth uniform?

Show Answer

No.

One brand reduces by 1/3 (slower decay, deeper path), the other by 2/3.

The tree is lopsided. The depth ranges from log_3 n to log_(3/2) n.