page236.html
来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 39 行
HTML
39 行
<HTML><HEAD><TITLE>Worst-Case Running Time</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="tex2html3919" HREF="page237.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html3917" HREF="page231.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html3913" HREF="page235.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html3921" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION008515000000000000000">Worst-Case Running Time</A></H3><P>Computing a tight bound on the worst-case running time ofProgram <A HREF="page235.html#progchainedScatterTabled"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> is tricky.Assuming the item to be removed is actually in the table,then the time required to find the item (lines 6-8) is<P> <IMG WIDTH=350 HEIGHT=16 ALIGN=BOTTOM ALT="displaymath62319" SRC="img962.gif" ><P>in the worst case.<P>The worst-case running time of the main loop occurswhen the table is full, there is only one chain,and no items can be safely moved up in the chain.In this case, the running time of the main loop (lines 11-28) is<P> <IMG WIDTH=360 HEIGHT=39 ALIGN=BOTTOM ALT="displaymath62320" SRC="img963.gif" ><P>Finally, the worst case running time of the last loop (lines 31-35) is <I>O</I>(<I>M</I>).<P>Therefore, the worst-case running time of the <tt>withdraw</tt> methodfor chained scatter tables is<P> <IMG WIDTH=419 HEIGHT=39 ALIGN=BOTTOM ALT="displaymath62321" SRC="img964.gif" ><P>Clearly we don't want to be removing itemsfrom a chained scatter table very often!<P><HR><A NAME="tex2html3919" HREF="page237.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html3917" HREF="page231.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html3913" HREF="page235.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html3921" 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 © 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 + -
显示快捷键?