Queue
Definition
A First-In-First-Out (FIFO) data structure where elements are added at the back and removed from the front. Used in BFS, task scheduling, and message queues. Common operations: enqueue (add), dequeue (remove), peek (view front).
Code Example
Learn More
Related Terms
A linear data structure where each element (node) contains a value and a pointer to the next node. Unlike arrays, linked lists don't require contiguous memory and allow O(1) insertions at the head, but have O(n) random access.
StackA Last-In-First-Out (LIFO) data structure where elements are added and removed from the same end (the top). The JavaScript call stack is a stack. Common operations: push (add to top), pop (remove from top), peek (view top).
Binary TreeA hierarchical data structure where each node has at most two children (left and right). A Binary Search Tree (BST) maintains the property that left children are smaller and right children are larger than the parent.