Interactive animations to help you understand how algorithms and data structures work under the hood.
Repeatedly swaps adjacent elements if they are in the wrong order.
O(n²)Finds the minimum element and places it at the beginning each pass.
O(n²)Builds sorted array one element at a time by inserting into position.
O(n²)Divides array in half, sorts each half, then merges them back.
O(n log n)Picks a pivot and partitions the array around it recursively.
O(n log n)Builds a max heap and repeatedly extracts the maximum element.
O(n log n)Non-comparison sort that counts occurrences of each value. Linear time for bounded integers.
O(n + k)Sorts integers digit by digit from least significant to most significant.
O(nk)Last-In-First-Out (LIFO) structure with push and pop operations.
LIFOFirst-In-First-Out (FIFO) structure with enqueue and dequeue.
FIFOLinear collection of nodes connected by pointers.
DynamicTree where left child < parent < right child.
O(log n)Complete binary tree with heap property — bubble up & down.
O(log n)Key-value store using hash functions with collision handling.
O(1) avgTree structure for efficient prefix-based string search and autocomplete.
O(L)Disjoint set structure with union by rank and path compression.
O(α(n))Explores all neighbors at present depth before moving deeper.
O(V + E)Explores as far as possible along each branch before backtracking.
O(V + E)Finds shortest paths from a source to all vertices.
O(V²)Finds shortest paths even with negative edge weights. Detects negative cycles.
O(VE)Builds minimum spanning tree by picking smallest edges.
O(E log E)Grows the minimum spanning tree one vertex at a time using a priority queue.
O(E log V)Linear ordering of vertices in a directed acyclic graph.
O(V + E)Memoization vs tabulation approaches to compute Fibonacci numbers.
O(n)Maximize value with weight constraint using a 2D DP table.
O(nW)Find the longest subsequence common to two sequences.
O(mn)Find the minimum number of coins needed to make a given amount.
O(nS)Minimum insertions, deletions, and substitutions to transform one string into another.
O(mn)Find the length of the longest strictly increasing subsequence in an array.
O(n log n)Use two pointers converging from both ends to solve sorted array problems.
O(n)Maintain a window that slides across the array for optimal subarrays.
O(n)Floyd's cycle detection — two pointers moving at different speeds.
O(n)Sort and merge overlapping intervals into non-overlapping ones.
O(n log n)Place each number at its correct index. Find missing or duplicate numbers in O(n).
O(n)Lower/upper bound, search in rotated array, peak finding, and more.
O(log n)Generate all subsets, permutations, or combinations using backtracking.
O(2ⁿ)Use a min-heap of size K to efficiently find the K largest elements.
O(n log k)Maintain a monotonic stack for Next Greater Element type problems.
O(n)