next up previous
Next: BuildHeap Up: l3 Previous: Pseudocode

Recursive Analysis



\psfig{figure=figures/f3-8.ps}

n = 5, $n_{subtree}$ = \(\lfloor 2n/3 \rfloor\) = 3



Note that this expression has the maximum value when the lowest level of the heap is exactly half full.



T(n) = T($\lfloor$ 2n/3 $\rfloor$) + $\Theta(1)$



Master: a = 1, b = 3/2, f(n) = $\Theta(1)$ = $\Theta(n^{log_{3/2} 1})$ = $\Theta(n^0)$ = $\Theta(1)$, Case 2

T(n) = \(\Theta(n^{log_{3/2} 1} lg n) \;=\; \Theta(lg n)\).


next up previous
Next: BuildHeap Up: l3 Previous: Pseudocode