Skip to content

Stacks and queues (array-backed) · ⁨栈与队列(用数组实现)⁩

English

Two ways to hold items

  • A stack and a queue both hold a line of items, but they differ in which item comes out next.
  • A stack is LIFO: Last In, First Out — like a pile of plates.
  • A queue is FIFO: First In, First Out — like a line of people.
中文

两种存放元素的方式

  • 栈和队列都存放一排元素,但它们的区别在于下一个出来的是哪个。
  • 栈是 LIFO:后进先出 —— 就像一摞盘子。
  • 队列是 FIFO:先进先出 —— 就像排队的人。

Handout

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩