跳到主要内容

资源 · 指南或文章

Queue

用一段话定义先进先出队列:enqueue 在队尾添加,dequeue 从队头移除,peek 读取队头元素。

审核日期

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

添加到路线图

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

来源内容语言:英语

Read this in other languages: 简体中文, Русский, 日本語, Français, Português, 한국어, Українська In computer science, a queue is a particular kind of abstract data type or collection in which the entities in the collection are kept in order and the principle (or only) operations on the collection are the addition of entities to the rear terminal position, known as enqueue, and removal of entities from the front terminal position, known as dequeue. This makes the queue a First-In-First-Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed. This is equivalent to the requirement that once a new element is added, all elements that were added before have to be removed before the new element can be removed. Often a peek or front operation is also entered, returning the value of the front element without dequeuing it. A queue is an example of a linear data structure, or more abstractly a sequential collection. Representation of a FIFO (first in, first out) queue

PrepKit 概览

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

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

涵盖内容

  • 先进先出的顺序规则以及可选的 peek 操作
  • 先进先出队列示意图

使用建议

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

用两个栈实现队列,并解释为什么每个元素在两个栈之间最多只移动一次。

范围与局限

页面上没有复杂度表、实现讨论或练习。

获取方式与形式

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

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

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

收录此条目的页面

订阅 PrepKit 通讯

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

我们如何处理你的邮箱