page509.html

来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 35 行

HTML
35
字号
<HTML><HEAD><TITLE>Running Time Analysis</TITLE></HEAD><BODY bgcolor="#FFFFFF"> <a href="../index.html" target="_top"><img src="../icons/usins.gif" alt="Logo" align=right></a><b>Data Structures and Algorithms with Object-Oriented Design Patterns in Python</b><br><A NAME="tex2html7018" HREF="page510.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7016" HREF="page505.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7012" HREF="page508.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html7020" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION0015604000000000000000">Running Time Analysis</A></H3><P>The running time of merge sort is determined by the runningtime of the recursive <tt>mergesort</tt> method.(The <tt>_sort</tt> method adds only a constant amount of overhead).The running time of the recursive <tt>mergesort</tt> method is givenby the following recurrence:<P><A NAME="eqnsortingix">&#160;</A> <IMG WIDTH=500 HEIGHT=48 ALIGN=BOTTOM ALT="equation44423" SRC="img2094.gif"  ><P>where  <IMG WIDTH=152 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline69669" SRC="img2092.gif"  >.<P>In order to simplify the solution of Equation&nbsp;<A HREF="page509.html#eqnsortingix"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>we shall assume that  <IMG WIDTH=45 HEIGHT=14 ALIGN=BOTTOM ALT="tex2html_wrap_inline58245" SRC="img168.gif"  > for some integer  <IMG WIDTH=37 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline60883" SRC="img708.gif"  >.Dropping the  <IMG WIDTH=27 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline57621" SRC="img1.gif"  >s from the equation we get<P> <IMG WIDTH=356 HEIGHT=48 ALIGN=BOTTOM ALT="displaymath69671" SRC="img2095.gif"  ><P>which is easily solved by repeated substitution:<P> <IMG WIDTH=500 HEIGHT=204 ALIGN=BOTTOM ALT="eqnarray44433" SRC="img2096.gif"  ><P>Therefore, the running time of merge sort is  <IMG WIDTH=68 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline59353" SRC="img402.gif"  >.<P><HR><A NAME="tex2html7018" HREF="page510.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7016" HREF="page505.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7012" HREF="page508.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html7020" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <P><ADDRESS><img src="../icons/bruno.gif" alt="Bruno" align=right><a href="../copyright.html">Copyright &#169; 2003</a> by <a href="../signature.html">Bruno R. Preiss, P.Eng.</a>  All rights reserved.</ADDRESS></BODY></HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?