This commit is contained in:
krahets
2024-04-02 19:00:08 +08:00
parent ec30155269
commit f95548a8c4
187 changed files with 72320 additions and 146 deletions

View File

@@ -3627,7 +3627,7 @@
<p><a class="glightbox" href="../array_representation_of_tree.assets/array_representation_binary_tree.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="完美二叉树的数组表示" class="animation-figure" src="../array_representation_of_tree.assets/array_representation_binary_tree.png" /></a></p>
<p align="center"> 图 7-12 &nbsp; 完美二叉树的数组表示 </p>
<p><strong>映射公式的角色相当于链表中的引用</strong>。给定数组中的任意一个节点,我们都可以通过映射公式来访问它的左(右)子节点。</p>
<p><strong>映射公式的角色相当于链表中的节点引用(指针)</strong>。给定数组中的任意一个节点,我们都可以通过映射公式来访问它的左(右)子节点。</p>
<h2 id="732">7.3.2 &nbsp; 表示任意二叉树<a class="headerlink" href="#732" title="Permanent link">&para;</a></h2>
<p>完美二叉树是一个特例,在二叉树的中间层通常存在许多 <code>None</code> 。由于层序遍历序列并不包含这些 <code>None</code> ,因此我们无法仅凭该序列来推测 <code>None</code> 的数量和分布位置。<strong>这意味着存在多种二叉树结构都符合该层序遍历序列</strong></p>
<p>如图 7-13 所示,给定一棵非完美二叉树,上述数组表示方法已经失效。</p>