跳到主要内容

资源 · 指南或文章

Stack

用几行文字讲栈的基础:push、pop 和 peek,后进先出的顺序,以及名称背后“一摞物品”的类比。

审核日期

打开原站: Stack (在新标签页中打开原网站)

添加到路线图

把这个资源放进你正在跟进的路线图。它会作为你自己的补充资源显示;路线图的步骤不会改变,也不计入你已记录的步骤。

来源内容语言:英语

Read this in other languages: 简体中文, Русский, 日本語, Français, Português, 한국어, Українська In computer science, a stack is an abstract data type that serves as a collection of elements, with two principal operations: The order in which elements come off a stack gives rise to its alternative name, LIFO (last in, first out). Additionally, a peek operation may give access to the top without modifying the stack. The name "stack" for this type of structure comes from the analogy to a set of physical items stacked on top of each other, which makes it easy to take an item off the top of the stack, while getting to an item deeper in the stack may require taking off multiple other items first.

PrepKit 概览

本概览由 PrepKit 编辑根据源代码仓库撰写并审核,并非资源本身的文字。

适合人群
来源未说明适用级别
形式
参考资料

涵盖内容

  • push、pop 以及可选的 peek 操作
  • 用一张运行时栈的示意图说明后进先出顺序

使用建议

这是 PrepKit 的学习建议,并非来源的说法。

实现一个能以常数时间返回当前最小值的最小栈,然后用普通栈检查括号是否匹配。

范围与局限

页面上没有复杂度、代码讨论或题目;YouTube 参考资料与队列页面链接的是同一个视频。

获取方式与形式

GitHub 上的简短 README,trekhleb/javascript-algorithms(MIT),附有七种译本。英文,免费阅读。

PrepKit 于 2026年10月2日 审核。 资源来源提交: 85293e3e2b88

本概览的依据
  • src/data-structures/stack/README.md

收录此条目的页面

订阅 PrepKit 通讯

可选。使用 PrepKit 并不需要订阅。

我们如何处理你的邮箱