Logo Data Structures and Algorithms with Object-Oriented Design Patterns in Java
next up previous contents index

Running Time Analysis

The running time of merge sort is determined by the running time of the recursive sort method. (The no-arg sort method adds only a constant amount of overhead). The running time of the recursive sort method is given by the following recurrence:

  equation44160

where tex2html_wrap_inline69277.

In order to simplify the solution of Equation gif we shall assume that tex2html_wrap_inline57818 for some integer tex2html_wrap_inline60478. Dropping the tex2html_wrap_inline57196s from the equation we get

displaymath69279

which is easily solved by repeated substitution:

eqnarray44170

Therefore, the running time of merge sort is tex2html_wrap_inline58926.


next up previous contents index

Bruno Copyright © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.