page187.html
来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 39 行
HTML
39 行
<HTML><HEAD><TITLE>Removing Arbitrary Items by Position</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="tex2html3360" HREF="page188.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html3358" HREF="page179.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html3354" HREF="page186.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html3362" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION007128000000000000000">Removing Arbitrary Items by Position</A></H3><P>The final method to be considered is the <tt>withdraw</tt>method of the <tt>OrderedListAsLinkedList.Cursor</tt> class.This method removes an arbitrary item from an ordered list,where the position of that item is specified by a cursor instance.The code for the <tt>withdraw</tt> methodis given in Program <A HREF="page187.html#progorderedListAsLinkedListg"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.<P><P><A NAME="9900"> </A><A NAME="progorderedListAsLinkedListg"> </A> <IMG WIDTH=575 HEIGHT=218 ALIGN=BOTTOM ALT="program9546" SRC="img759.gif" ><BR><STRONG>Program:</STRONG> <tt>OrderedListAsLinkedList.Cursor</tt> class <tt>withdraw</tt> method.<BR><P><P>The item in the linked list at the position specified by the cursoris removed by calling the <tt>extract</tt> methodprovided by the <tt>LinkedList</tt> class.The running time of the <tt>withdraw</tt> method depends on the running timeof the <tt>extract</tt> of the <tt>LinkedList</tt> class.The latter was shown to be <I>O</I>(<I>n</I>) where <I>n</I> is the numberof items in the linked list.Consequently, the total running time is <I>O</I>(<I>n</I>).<P><HR><A NAME="tex2html3360" HREF="page188.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html3358" HREF="page179.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html3354" HREF="page186.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html3362" 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 + -
显示快捷键?