next up previous
Next: Iteration Up: CSE 2320: Algorithms and Previous: Example: Use both methods

Substitution

T(n) = O(n3) $\leq$ cn3, Assume T(n/2) $\leq$ c(n/2)3
T(n) $\leq$ 2c(n/2)3 + n3
= 1/4cn3 + n3
= (1 + c/4)n3
$\leq$ cn3 when
1 + c/4 $\leq$ c, 3/4c $\geq$ 1, c $\geq$ 4/3



T(n) = $\Omega$(n3) $\geq$ cn3, T(n/2) $\geq$ c(n/2)3
T(n) $\geq$ 2c(n/2)3 + n3
= 1/4cn3 + n3
= (1 + c/4)n3
$\geq$ cn3 when
1 + c/4 $\geq$ c, 3/4c $\leq$ 1, c $\leq$ 4/3



Thus, T(n) = $\Theta(n^3)$.



Copyright © 1998 The University of Texas at Arlington