mirror of
https://github.com/krahets/hello-algo.git
synced 2026-02-03 10:53:35 +08:00
deploy
This commit is contained in:
@@ -3732,7 +3732,7 @@
|
||||
<!-- Page content -->
|
||||
<h1 id="51">5.1 栈<a class="headerlink" href="#51" title="Permanent link">¶</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 栈的先入后出规则 </p>
|
||||
|
||||
Reference in New Issue
Block a user