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

📄 page301.html

📁 Data Structures And Algorithms With Object-Oriented Design Patterns In Python (2003) source code and
💻 HTML
字号:
<HTML><HEAD><TITLE>Binary 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="tex2html4669" HREF="page302.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html4667" HREF="page299.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html4663" HREF="page300.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html4671" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H2><A NAME="SECTION0010120000000000000000">Binary Search Trees</A></H2><P>Just as the binary tree is an important category of <I>N</I>-ary trees,the <em>binary search tree</em><A NAME=18067>&#160;</A>is an important category of <I>M</I>-way search trees.<P><BLOCKQUOTE> <b>Definition (Binary Search Tree)</b><A NAME="defnbst">&#160;</A>A <em>binary search tree</em><A NAME=18072>&#160;</A><A NAME=18073>&#160;</A> <I>T</I> is a finite set of keys.Either the set is empty,  <IMG WIDTH=40 HEIGHT=27 ALIGN=MIDDLE ALT="tex2html_wrap_inline62991" SRC="img1064.gif"  >;or the set consists of a root <I>r</I>and exactly two binary search trees  <IMG WIDTH=18 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline63147" SRC="img1085.gif"  > and  <IMG WIDTH=18 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline63149" SRC="img1086.gif"  >,  <IMG WIDTH=108 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline63151" SRC="img1087.gif"  >,such that the following properties are satisfied:<OL><LI>	All the keys contained in left subtree,  <IMG WIDTH=18 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline63147" SRC="img1085.gif"  >, are less than <I>r</I>.<LI>	All the keys contained in the right subtree,  <IMG WIDTH=18 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline63149" SRC="img1086.gif"  >,	are greater than <I>r</I>.</OL></BLOCKQUOTE><P>Figure&nbsp;<A HREF="page301.html#figtree12"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> shows an example of a binary search tree.In this case, since the nodes of the tree carry alphabeticrather than numeric keys,the ordering of the keys is alphabetic.That is, all the keys in the left subtree of a given nodeprecede alphabetically the root of the that node,and all the keys in the right subtree of a given nodefollow alphabetically the root of that node.The empty trees are shown explicitly as boxes in Figure&nbsp;<A HREF="page301.html#figtree12"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.However, in order to simplify the graphical representation,the empty trees are often omitted from the diagrams.<P><P><A NAME="18182">&#160;</A><A NAME="figtree12">&#160;</A> <IMG WIDTH=575 HEIGHT=222 ALIGN=BOTTOM ALT="figure18079" SRC="img1180.gif"  ><BR><STRONG>Figure:</STRONG> A binary search tree.<BR><P><HR><A NAME="tex2html4669" HREF="page302.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html4667" HREF="page299.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html4663" HREF="page300.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html4671" 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 + -