Data Structures and Algorithms with Object-Oriented Design Patterns in C#
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:

  equation44330

where tex2html_wrap_inline69464.

In order to simplify the solution of Equation gif we shall assume that tex2html_wrap_inline58019 for some integer tex2html_wrap_inline60665. Dropping the tex2html_wrap_inline57397s from the equation we get

displaymath69466

which is easily solved by repeated substitution:

eqnarray44340

Therefore, the running time of merge sort is tex2html_wrap_inline59127.


next up previous contents index

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