📄 chapter4.htm
字号:
<html><!-- #BeginTemplate "/Templates/article_template.dwt" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="algorithm, data structure, contest, programming, 算法, 数据结构, 程序设计, 竞赛">
<meta name="description" content="discussing the algorithm and data structure of computer programming, as well as all kinds of programming contest.">
<meta name="description" content="讨论程序设计的算法与数据结构,各类程序设计竞赛试题解析和参赛经验介绍。">
<!-- #BeginEditable "doctitle" -->
<title>ADT树的操作</title>
<!-- #EndEditable -->
<script id="header" language="JavaScript" src="../../../lib/header.js"></script>
<!-- #BeginEditable "javascript" -->
<script language="JavaScript">
var previous = "chapter3.htm";
var next = "chapter5.htm";
</script>
<!-- #EndEditable -->
</head>
<body bgcolor="#FFFFFF">
<div id="content">
<!-- #BeginEditable "MainContent" -->
<h2>ADT树的操作</h2>
<p>树的最重要的作用之一是用以实现各种各样的抽象数据类型。与<a href="../list/chapter1.htm">表</a>的情形相同,定义在树上的操作也是多种多样的。在这里我们只考虑作为抽象数据类型的树的几种典型操作。</p>
<p>以下的∧表示空结点,∧在树的不同实现方法中有不同的定义。</p>
<blockquote>
<p align="center"><b>ADT树的基本运算</b></p>
</blockquote>
<div align="center">
<center>
<table border="0" width="90%" cellpadding="5">
<tr>
<td width="42%" style="font-size: 10pt" bgcolor="#E0E0E0" align="center"><b>运算</b></td>
<td width="58%" style="font-size: 10pt" bgcolor="#E0E0E0" align="center"><b>含义</b></td>
</tr>
<tr>
<td width="42%" style="font-size: 10pt" bgcolor="#E0E0E0">Parent(v,T)</td>
<td width="58%" style="font-size: 10pt" bgcolor="#E0E0E0">这是一个求父结点的函数,函数值为树T中结点v的父亲。当v是根结点时,函数值为∧,表示结点v没有父结点。</td>
</tr>
<tr>
<td width="42%" style="font-size: 10pt" bgcolor="#E0E0E0">Leftmost_Child(v,T)</td>
<td width="58%" style="font-size: 10pt" bgcolor="#E0E0E0">这是一个求最左儿子结点的函数。函数值为树T中结点v的最左儿子。当v是叶结点时,函数值为∧,表示结点v没有儿子。</td>
</tr>
<tr>
<td width="42%" style="font-size: 10pt" bgcolor="#E0E0E0">Right_Sibling(v,T)</td>
<td width="58%" style="font-size: 10pt" bgcolor="#E0E0E0">这是一个求右邻兄弟的函数,函数值为树T中结点v的右邻兄弟。当v没有右邻兄弟时,函数值为∧。</td>
</tr>
<tr>
<td width="42%" style="font-size: 10pt" bgcolor="#E0E0E0">Create(i,x,T<sub>1</sub>,T<sub>2</sub>,..,T<sub>i</sub>,T)</td>
<td width="58%" style="font-size: 10pt" bgcolor="#E0E0E0">这是一族建树过程。对于每一个非负整数i,该函数生成一棵新树T,T的根结点是标号为x的新结点v,并令v有i个儿子,这些儿子从左到右分别为树T<sub>1</sub>,T<sub>2</sub>,..,T<sub>i</sub>的根。当i=0时,v既是树根,又是树叶。</td>
</tr>
<tr>
<td width="42%" style="font-size: 10pt" bgcolor="#E0E0E0">Label(v,T)</td>
<td width="58%" style="font-size: 10pt" bgcolor="#E0E0E0">这时一个求标号的函数,函数值就是结点v的标号。</td>
</tr>
<tr>
<td width="42%" style="font-size: 10pt" bgcolor="#E0E0E0">Root(T)</td>
<td width="58%" style="font-size: 10pt" bgcolor="#E0E0E0">这是一个求树根的函数,函数值为树T的根结点。当T是空树时,函数值为∧。</td>
</tr>
<tr>
<td width="42%" style="font-size: 10pt" bgcolor="#E0E0E0">MakeNull(T)</td>
<td width="58%" style="font-size: 10pt" bgcolor="#E0E0E0">这是一个过程,它使T成为一棵空树。</td>
</tr>
</table>
</center>
</div>
<!-- #EndEditable -->
</div>
<script src='../../../lib/footer.js'>
</script>
</body>
<!-- #EndTemplate --></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -