page331.html
来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 45 行
HTML
45 行
<HTML><HEAD><TITLE>Implementing M-Way Search Trees</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="tex2html5009" HREF="page332.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html5007" HREF="page330.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html5001" HREF="page330.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html5011" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H2><A NAME="SECTION0010610000000000000000">Implementing <I>M</I>-Way Search Trees</A></H2><P><A NAME="secsrchtreemwayimpl"> </A><P>In order to illustrate the basic ideas,this section describes an implementationof <I>M</I>-way search trees in main memory.According to Definition <A HREF="page300.html#defnmwaytree"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>,each internal node of an <I>M</I>-way search tree has <I>n</I> subtrees,where <I>n</I> is at least two and at most <I>M</I>.Furthermore, if a node has <I>n</I> subtrees,it must contain <I>n</I>-1 keys.<P>Figure <A HREF="page331.html#figmway"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> shows how we can implementa single node of an <I>M</I>-way search tree.The idea is that we use two arrays in each node--the first holds the keysand the second contains pointers to the subtrees.Since there are at most <I>M</I> subtrees but only <I>M</I>-1 keys,the first element of the array of keys is not used.<P><P><A NAME="20807"> </A><A NAME="figmway"> </A> <IMG WIDTH=575 HEIGHT=252 ALIGN=BOTTOM ALT="figure20399" SRC="img1298.gif" ><BR><STRONG>Figure:</STRONG> Representing a node of an <I>M</I>-way search tree.<BR><P><BR> <HR><UL> <LI> <A NAME="tex2html5012" HREF="page332.html#SECTION0010611000000000000000">Implementation</A><LI> <A NAME="tex2html5013" HREF="page333.html#SECTION0010612000000000000000"><tt>__init__</tt> Method and <tt>m</tt> Property</A><LI> <A NAME="tex2html5014" HREF="page334.html#SECTION0010613000000000000000">Inorder Traversal</A></UL><HR><A NAME="tex2html5009" HREF="page332.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html5007" HREF="page330.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html5001" HREF="page330.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html5011" 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 + -
显示快捷键?