next up previous
Next: Summary Up: CSE 2320: Algorithms and Previous: For larger input size:

Analysis of Merge Sort

Note if n = 1, Then T(n) = $\Theta(1)$

1.
DIVIDE computes middle of array in constant time: D(n) = $\Theta(1)$
2.
CONQUER sorts 2 subarrays of size n/2 in time: 2T(n/2)
3.
COMBINE (Merge) procedure: C(n) = $\Theta(n)$



T(n) = \(\left\{ \begin{array}{ll}
\Theta(1) & {\rm if} \; n = 1 \\
2T(n/2) + \Theta(1) + \Theta(n) & {\rm if} \; n > 1
\end{array} \right.\)



Note that $\Theta(n)$ dominates $\Theta(1)$.



We will show next class that T(n) = $\Theta(n \lg n)$, where lg = $\log_2 n$.



Copyright © 1998 The University of Texas at Arlington