This commit is contained in:
krahets 2023-08-21 19:39:31 +08:00
parent c359c07fe0
commit 77b90cd19b
3 changed files with 29 additions and 29 deletions

View file

@ -1400,6 +1400,13 @@
1.   初始化二叉树
</a>
</li>
<li class="md-nav__item">
<a href="#2" class="md-nav__link">
2. &nbsp; 插入与删除节点
</a>
</li>
</ul>
@ -1409,17 +1416,10 @@
<li class="md-nav__item">
<a href="#713" class="md-nav__link">
7.1.3 &nbsp; 插入与删除节点
7.1.3 &nbsp; 常见二叉树类型
</a>
</li>
<li class="md-nav__item">
<a href="#714" class="md-nav__link">
7.1.4 &nbsp; 常见二叉树类型
</a>
<nav class="md-nav" aria-label="7.1.4   常见二叉树类型">
<nav class="md-nav" aria-label="7.1.3   常见二叉树类型">
<ul class="md-nav__list">
<li class="md-nav__item">
@ -1430,7 +1430,7 @@
</li>
<li class="md-nav__item">
<a href="#2" class="md-nav__link">
<a href="#2_1" class="md-nav__link">
2. &nbsp; 完全二叉树
</a>
@ -1456,8 +1456,8 @@
</li>
<li class="md-nav__item">
<a href="#715" class="md-nav__link">
7.1.5 &nbsp; 二叉树的退化
<a href="#714" class="md-nav__link">
7.1.4 &nbsp; 二叉树的退化
</a>
</li>
@ -3462,6 +3462,13 @@
1. &nbsp; 初始化二叉树
</a>
</li>
<li class="md-nav__item">
<a href="#2" class="md-nav__link">
2. &nbsp; 插入与删除节点
</a>
</li>
</ul>
@ -3471,17 +3478,10 @@
<li class="md-nav__item">
<a href="#713" class="md-nav__link">
7.1.3 &nbsp; 插入与删除节点
7.1.3 &nbsp; 常见二叉树类型
</a>
</li>
<li class="md-nav__item">
<a href="#714" class="md-nav__link">
7.1.4 &nbsp; 常见二叉树类型
</a>
<nav class="md-nav" aria-label="7.1.4   常见二叉树类型">
<nav class="md-nav" aria-label="7.1.3   常见二叉树类型">
<ul class="md-nav__list">
<li class="md-nav__item">
@ -3492,7 +3492,7 @@
</li>
<li class="md-nav__item">
<a href="#2" class="md-nav__link">
<a href="#2_1" class="md-nav__link">
2. &nbsp; 完全二叉树
</a>
@ -3518,8 +3518,8 @@
</li>
<li class="md-nav__item">
<a href="#715" class="md-nav__link">
7.1.5 &nbsp; 二叉树的退化
<a href="#714" class="md-nav__link">
7.1.4 &nbsp; 二叉树的退化
</a>
</li>
@ -3875,7 +3875,7 @@
</div>
</div>
</div>
<h2 id="713">7.1.3 &nbsp; 插入与删除节点<a class="headerlink" href="#713" title="Permanent link">&para;</a></h2>
<h3 id="2">2. &nbsp; 插入与删除节点<a class="headerlink" href="#2" title="Permanent link">&para;</a></h3>
<p>与链表类似,在二叉树中插入与删除节点可以通过修改指针来实现。下图给出了一个示例。</p>
<p><img alt="在二叉树中插入与删除节点" src="../binary_tree.assets/binary_tree_add_remove.png" /></p>
<p align="center"> 图:在二叉树中插入与删除节点 </p>
@ -3994,7 +3994,7 @@
<p class="admonition-title">Note</p>
<p>需要注意的是,插入节点可能会改变二叉树的原有逻辑结构,而删除节点通常意味着删除该节点及其所有子树。因此,在二叉树中,插入与删除操作通常是由一套操作配合完成的,以实现有实际意义的操作。</p>
</div>
<h2 id="714">7.1.4 &nbsp; 常见二叉树类型<a class="headerlink" href="#714" title="Permanent link">&para;</a></h2>
<h2 id="713">7.1.3 &nbsp; 常见二叉树类型<a class="headerlink" href="#713" title="Permanent link">&para;</a></h2>
<h3 id="1_1">1. &nbsp; 完美二叉树<a class="headerlink" href="#1_1" title="Permanent link">&para;</a></h3>
<p>「完美二叉树 perfect binary tree」除了最底层外其余所有层的节点都被完全填满。在完美二叉树中叶节点的度为 <span class="arithmatex">\(0\)</span> ,其余所有节点的度都为 <span class="arithmatex">\(2\)</span> ;若树高度为 <span class="arithmatex">\(h\)</span> ,则节点总数为 <span class="arithmatex">\(2^{h+1} - 1\)</span> ,呈现标准的指数级关系,反映了自然界中常见的细胞分裂现象。</p>
<div class="admonition tip">
@ -4004,7 +4004,7 @@
<p><img alt="完美二叉树" src="../binary_tree.assets/perfect_binary_tree.png" /></p>
<p align="center"> 图:完美二叉树 </p>
<h3 id="2">2. &nbsp; 完全二叉树<a class="headerlink" href="#2" title="Permanent link">&para;</a></h3>
<h3 id="2_1">2. &nbsp; 完全二叉树<a class="headerlink" href="#2_1" title="Permanent link">&para;</a></h3>
<p>如下图所示,「完全二叉树 complete binary tree」只有最底层的节点未被填满且最底层节点尽量靠左填充。</p>
<p><img alt="完全二叉树" src="../binary_tree.assets/complete_binary_tree.png" /></p>
<p align="center"> 图:完全二叉树 </p>
@ -4019,7 +4019,7 @@
<p><img alt="平衡二叉树" src="../binary_tree.assets/balanced_binary_tree.png" /></p>
<p align="center"> 图:平衡二叉树 </p>
<h2 id="715">7.1.5 &nbsp; 二叉树的退化<a class="headerlink" href="#715" title="Permanent link">&para;</a></h2>
<h2 id="714">7.1.4 &nbsp; 二叉树的退化<a class="headerlink" href="#714" title="Permanent link">&para;</a></h2>
<p>当二叉树的每层节点都被填满时,达到“完美二叉树”;而当所有节点都偏向一侧时,二叉树退化为“链表”。</p>
<ul>
<li>完美二叉树是理想情况,可以充分发挥二叉树“分治”的优势。</li>

File diff suppressed because one or more lines are too long

Binary file not shown.