page185.html
来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 40 行
HTML
40 行
<HTML><HEAD><TITLE>Finding the Position of an Item and Accessing 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="tex2html3340" HREF="page186.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html3338" HREF="page179.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html3332" HREF="page184.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html3342" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION007126000000000000000">Finding the Position of an Item and Accessing by Position</A></H3><P>The <tt>findPosition</tt> method of the <tt>OrderedListAsLinkedList</tt>class is used to determine the position of an item in an ordered listimplemented as a linked list.Its result is an instance of the nested <tt>Cursor</tt> class.The <tt>findPosition</tt> methodis defined in Program <A HREF="page185.html#progorderedListAsLinkedListe"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A><P><P><A NAME="9896"> </A><A NAME="progorderedListAsLinkedListe"> </A> <IMG WIDTH=575 HEIGHT=218 ALIGN=BOTTOM ALT="program9502" SRC="img757.gif" ><BR><STRONG>Program:</STRONG> <tt>OrderedListAsLinkedList</tt> class <tt>findPosition</tt> method<BR><P><P>In addition to <tt>self</tt>,the <tt>findPosition</tt> method takes as its argumentan object that is the target of the search.The search algorithm used by <tt>findPosition</tt> is identical to that of<tt>find</tt>, which is given in Program <A HREF="page182.html#progorderedListAsLinkedListc"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.Consequently, the running time is the same: <IMG WIDTH=136 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline61009" SRC="img738.gif" >,where <IMG WIDTH=53 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline61007" SRC="img737.gif" > is the time required to match two objects,and <IMG WIDTH=78 HEIGHT=9 ALIGN=BOTTOM ALT="tex2html_wrap_inline61037" SRC="img743.gif" > is the number of items in the ordered list.<P><HR><A NAME="tex2html3340" HREF="page186.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html3338" HREF="page179.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html3332" HREF="page184.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html3342" 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 + -
显示快捷键?