This commit is contained in:
krahets
2025-09-20 20:08:10 +08:00
parent fe56286bb0
commit 36350f0058
42 changed files with 363 additions and 353 deletions

View File

@@ -3732,7 +3732,7 @@
<!-- Page content -->
<h1 id="51">5.1 &nbsp;<a class="headerlink" href="#51" title="Permanent link">&para;</a></h1>
<p><u>stack</u>是一种遵循先入后出逻辑的线性数据结构。</p>
<p>我们可以将栈类比为桌面上的一摞盘子,如果想取出底部的盘子,则需要先将上面的盘子依次移走。我们将盘子替换为各种类型的元素(如整数、字符、对象等),就得到了栈这种数据结构。</p>
<p>我们可以将栈类比为桌面上的一摞盘子,规定每次只能移动一个盘子,那么想取出底部的盘子,则需要先将上面的盘子依次移走。我们将盘子替换为各种类型的元素(如整数、字符、对象等),就得到了栈这种数据结构。</p>
<p>如图 5-1 所示,我们把堆叠元素的顶部称为“栈顶”,底部称为“栈底”。将把元素添加到栈顶的操作叫作“入栈”,删除栈顶元素的操作叫作“出栈”。</p>
<p><a class="glightbox" href="../stack.assets/stack_operations.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="栈的先入后出规则" class="animation-figure" src="../stack.assets/stack_operations.png" /></a></p>
<p align="center"> 图 5-1 &nbsp; 栈的先入后出规则 </p>