Stack
Definition
A 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).
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.
QueueA 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).
RecursionA technique where a function calls itself to solve smaller instances of the same problem. Every recursive function needs a base case (stopping condition) and a recursive case. Common in tree traversals, divide-and-conquer algorithms, and mathematical computations.