enqueue and dequeue
The two basic queue operations: enqueue adds an item at the back and dequeue removes the item at the front.
In more detail
With a deque, enqueue is append and dequeue is popleft. Do not confuse "dequeue", the operation, with "deque", the double-ended queue data structure.
Related terms
- queue — A collection where items leave in the order they arrived: first in, first out, like a line at a shop counter.
- deque — A double-ended queue: a sequence that adds and removes items at either end in O(1) time; Python provides it as collections.deque.
Taught in
- Stacks And Queues: Last In Or First In — Algorithms & Data Structures for Working Engineers
- Binary Trees And Their Traversals — Algorithms & Data Structures for Working Engineers
- B-Trees: The Structure Behind Every Database Index — Algorithms & Data Structures for Working Engineers
- Breadth-First Search And Shortest Paths By Hops — Algorithms & Data Structures for Working Engineers