Data Structures & Algorithms
Interactive visualizations, code examples in Swift, Kotlin, TypeScript, Python & Java, and curated LeetCode problems, one topic at a time.
Data Structures
A contiguous block of memory storing elements of the same type, accessible by index in O(1) time.
A sequence of nodes where each node holds a value and a pointer to the next node.
A LIFO (Last In, First Out) structure where elements are added and removed from the same end (top).
A FIFO (First In, First Out) structure where elements are added at the back and removed from the front.
A key-value store that uses a hash function to map keys to bucket indices, enabling O(1) average lookups.
Sorting
Repeatedly swaps adjacent elements that are out of order, "bubbling" the largest unsorted element to its correct position each pass.
Repeatedly finds the minimum element from the unsorted portion and moves it to the sorted boundary.
Builds a sorted sub-array one element at a time by inserting each new element into its correct position.
A divide-and-conquer algorithm that recursively splits the array in half, sorts each half, then merges them back.
A divide-and-conquer algorithm that picks a pivot, partitions elements around it, then recursively sorts each partition.
Searching
Scans every element from the start until the target is found or the end is reached. Works on any unsorted collection.
Halves the search space each step by comparing the target to the middle element. Requires a sorted collection.
Graph Algorithms
Explores all neighbors at the current depth before moving deeper, using a queue to process nodes level by level.
Explores as deep as possible along each branch before backtracking, using recursion or an explicit stack.