page334.html
来自「wqeqwvrw rkjqhwrjwq jkhrjqwhrwq jkhrwq」· HTML 代码 · 共 47 行
HTML
47 行
<HTML>
<HEAD>
<TITLE>Inorder Traversal</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<img src="cover75.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cover75.gif" alt="Logo" align=right>
<b>Data Structures and Algorithms
with Object-Oriented Design Patterns in C++</b><br>
<A NAME="tex2html6055" HREF="page335.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page335.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="next_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/next_motif.gif"></A> <A NAME="tex2html6053" HREF="page331.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page331.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="up_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/up_motif.gif"></A> <A NAME="tex2html6049" HREF="page333.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page333.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/previous_motif.gif"></A> <A NAME="tex2html6057" HREF="page9.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page9.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/contents_motif.gif"></A> <A NAME="tex2html6058" HREF="page620.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page620.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="index_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/index_motif.gif"></A> <BR><HR>
<H3><A NAME="SECTION0011613000000000000000">Inorder Traversal</A></H3>
<P>
Whereas inorder traversal of an <I>N</I>-ary tree is <em>not</em> defined for <I>N</I><I>></I>2,
inorder traversal <em>is</em> defined for an <I>M</I>-way search tree:
By definition, the inorder traversal of a search tree visits
all the keys contained in the search tree <em>in order</em>.
<P>
Program <A HREF="page334.html#progmwaytree1c" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page334.html#progmwaytree1c"><IMG ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A> is an implementation of
the algorithm for depth-first traversal of an <I>M</I>-way search tree
given in Section <A HREF="page310.html#secsrchtreetraversal" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page310.html#secsrchtreetraversal"><IMG ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>.
The keys contained in a given node are visited
(by calling the <tt>Visit</tt> member function of the visitor)
<em>in between</em> the appropriate subtrees of that node.
In addition,
the <tt>PreVisit</tt> function is called for each key contained in a node
before traversing any of the subtrees of that node
and the <tt>PostVisit</tt> function is called for each key
in the node after all the subtrees have been traversed.
<P>
<P><A NAME="21718"> </A><A NAME="progmwaytree1c"> </A> <IMG WIDTH=575 HEIGHT=334 ALIGN=BOTTOM ALT="program21563" SRC="img1359.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img1359.gif" ><BR>
<STRONG>Program:</STRONG> <tt>MWayTree</tt> Class <tt>DepthFirstTraversal</tt> Member Function Definition<BR>
<P>
<P>
It is clear that the amount of work done at each node
during the course of a depth-first traversal
is proportional to the number of keys contained in that node.
Therefore, the total running time for the depth-first traversal is
<IMG WIDTH=365 HEIGHT=26 ALIGN=MIDDLE ALT="tex2html_wrap_inline65436" SRC="img1360.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img1360.gif" >,
where <I>K</I> is the number of keys contained in the search tree.
<P>
<HR><A NAME="tex2html6055" HREF="page335.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page335.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="next_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/next_motif.gif"></A> <A NAME="tex2html6053" HREF="page331.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page331.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="up_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/up_motif.gif"></A> <A NAME="tex2html6049" HREF="page333.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page333.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/previous_motif.gif"></A> <A NAME="tex2html6057" HREF="page9.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page9.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/contents_motif.gif"></A> <A NAME="tex2html6058" HREF="page620.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page620.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="index_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/index_motif.gif"></A> <P><ADDRESS>
<img src="bruno.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/bruno.gif" alt="Bruno" align=right>
<a href="javascript:if(confirm('http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/copyright.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/copyright.html'" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/copyright.html">Copyright © 1997</a> by <a href="javascript:if(confirm('http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/signature.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/signature.html'" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/signature.html">Bruno R. Preiss, P.Eng.</a> All rights reserved.
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?