⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page303.html

📁 Data Structures And Algorithms With Object-Oriented Design Patterns In Python (2003) source code and
💻 HTML
字号:
<HTML><HEAD><TITLE>Searching an M-way Tree</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="tex2html4693" HREF="page304.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html4691" HREF="page302.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html4685" HREF="page302.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html4695" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION0010201000000000000000">Searching an <I>M</I>-way Tree</A></H3><P>Consider the search for a particular item, say <I>x</I>,in an <I>M</I>-way search tree.The search always begins at the root.If the tree is empty, the search fails.Otherwise, the keys contained in the root node are examined to determineif the object of the search is present.If it is, the search terminates successfully.If it is not,there are three possibilities:Either the object of the search, <I>x</I>, is less than  <IMG WIDTH=13 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline63723" SRC="img1169.gif"  >,in which case subtree  <IMG WIDTH=15 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline63001" SRC="img1066.gif"  > is searched; or<I>x</I> is greater than  <IMG WIDTH=31 HEIGHT=20 ALIGN=MIDDLE ALT="tex2html_wrap_inline63727" SRC="img1171.gif"  >,in which case subtree  <IMG WIDTH=32 HEIGHT=20 ALIGN=MIDDLE ALT="tex2html_wrap_inline63719" SRC="img1168.gif"  > is searched; orthere exists an <I>i</I> such that  <IMG WIDTH=91 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline63801" SRC="img1181.gif"  > for which  <IMG WIDTH=92 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline63803" SRC="img1182.gif"  >,in which case subtree  <IMG WIDTH=14 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline62823" SRC="img1051.gif"  > is searched.<P>Notice that when <I>x</I> is not found in a given node,only one of the <I>n</I> subtrees of that node is searched.Therefore, a complete tree traversal is not required.A successful search begins at the root and tracesa downward path in the tree,which terminates at the node containing the object of the search.Clearly, the running time of a successful search is determinedby the <em>depth</em> in the tree of object of the search.<P>When the object of the search is not in the search tree,the search method described above traces a downward path fromthe root which terminates when an empty subtree is encountered.In the worst case, the search path passes through the deepest leaf node.Therefore, the worst-case running time for an unsuccessful searchis determined by the <em>height</em> of the search tree.<P><HR><A NAME="tex2html4693" HREF="page304.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html4691" HREF="page302.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html4685" HREF="page302.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html4695" 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -