Data structures and algorithms, visualized
Each topic runs the real algorithm on an input you can change, one operation at a time, so you can watch the invariant hold instead of memorising the code.
New to this? Start with Big-O and arrays, then work down the list: it follows the order the topics build on each other.
Start with Complexity Analysis (Big-O) 48 topics
Start here
Beginner topics, in the order they build on each other.
- Complexity Analysis (Big-O)Build real intuition for how O(1), O(log n), O(n), O(n log n), O(n²), and O(2ⁿ) actually diverge as input size grows — and practice recognizing which class a piece of code belongs to, the single most common warm-up question in any technical interview.Beginner15m
- Arrays & ListsMaster the most fundamental data structure - arrays and lists. Learn about random access, sequential operations, and memory layout.Beginner15m
- Linked ListA linear data structure where elements are not stored at contiguous memory locations. The elements are linked using pointers.Beginner15m
- Stack Data StructureUnderstand the Last-In-First-Out (LIFO) principle. Visualize Push, Pop, and Peek operations.BeginnerCode15m
- Queue Data StructureUnderstand the First-In-First-Out (FIFO) principle. Visualize Enqueue and Dequeue operations.Beginner15m
- Binary SearchUnderstand the power of O(log n). Visualize dividing the search space in half to find targets in sorted arrays instantly.BeginnerCode15m
- Bubble SortThe simplest sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. "Bubbling" the largest element to the top.Beginner10m
- Selection SortA simple comparison-based sorting algorithm. It divides the list into sorted and unsorted regions, repeatedly selecting the minimum element from the unsorted region.Beginner10m
- Breadth-First Search (BFS)A fundamental graph traversal algorithm. It explores all neighbor nodes at the present depth prior to moving on to the nodes at the next depth level. It guarantees the shortest path in an unweighted graph.Beginner25m
- Fibonacci Sequence (DP)A classic example of Dynamic Programming. We calculate the Nth number by summing the two preceding ones, storing results in a table (Bottom-Up) to avoid redundant calculations.Beginner10m
- Two Pointers TechniqueMaster the Two Pointers technique! Visualize how moving start and end pointers can check whether a string is a palindrome in linear time — one of the most common patterns for array and string problems, and a must-know for FAANG interviews.BeginnerCode20m
- Prefix SumLearn the Prefix Sum technique to answer range sum queries in O(1) time. Visualize how pre-computation transforms the array.BeginnerCode15m
Next
Intermediate topics.
- Merge SortA classic Divide and Conquer algorithm. It divides the input array into two halves, calls itself for the two halves, and then merges the two sorted halves.Intermediate15m
- Quick SortA highly efficient Divide and Conquer algorithm. It picks an element as pivot and partitions the given array around the picked pivot.Intermediate20m
- Heap SortA comparison-based sorting algorithm that uses a Binary Heap data structure. It divides its input into a sorted and an unsorted region, and iteratively shrinks the unsorted region by extracting the largest element.Intermediate20m
- Counting SortA non-comparison sorting algorithm that achieves O(n+k) time by counting occurrences. Perfect when the range of values (k) is not significantly larger than n.Intermediate20m
- Radix SortSort integers digit by digit using a stable sort (like Counting Sort) as a subroutine. Achieves O(d×(n+b)) time where d is the number of digits and b is the base.Intermediate25m
- Binary Search Tree (BST)A hierarchical data structure where each node has at most two children. For any node, the left child is smaller and the right child is larger, allowing for efficient O(log n) average-case search, insertion, and deletion (this degrades to O(n) on an unbalanced tree).Intermediate20m
- Heap (Priority Queue)A specialized tree-based data structure which is essentially a complete binary tree that satisfies the heap property. In a max heap, for any given node I, the value of I is greater than or equal to the values of its children.Intermediate20m
- Depth-First Search (DFS)Explore graphs by going deep! Unlike BFS, DFS dives into the graph structure. Essential for detecting cycles, topological sort, and maze solving.IntermediateCode20m
- Topological SortOrder tasks with dependencies! Visualize Kahn's Algorithm using In-Degrees. Crucial for build systems, course scheduling, and resolving dependencies.IntermediateCode25m
- Hash Map: Collision HandlingVisualize how internal Hash Tables work! See how keys are hashed to indices and how collisions are resolved using Chaining (Linked Lists).IntermediateCode20m
- Trie (Prefix Tree)Optimize prefix-based searches! Visualize how words are stored as a tree of characters. Key for autocomplete and spell checkers.IntermediateCode20m
- Union-Find (Disjoint Set)Master the Union-Find data structure. Essential for Kruskal's Algorithm, connected components, and cycle detection in undirected graphs.IntermediateCode20m
- LRU Cache DesignA classic design problem combining HashMap for O(1) lookup with Doubly Linked List for O(1) ordering. Foundation for caching systems and system design interviews.IntermediateCode25m
- Sliding WindowVisualize the fixed-size Sliding Window technique for maximum-sum subarray problems. See how reusing the previous window sum avoids redundant calculation, reducing the O(n·k) nested-loop approach to a single O(n) pass.IntermediateCode25m
- Monotonic StackSolve "Next Greater Element" and "Daily Temperatures" problems efficiently! Visualize how maintaining a sorted stack helps find nearest larger/smaller elements in O(n).IntermediateCode25m
- Kadane's AlgorithmFind the maximum sum contiguous subarray in O(n) time. The quintessential dynamic programming problem that every FAANG interview expects you to know.Intermediate15m
- Bit ManipulationBit manipulation involves working directly with the binary representation of data. Master AND, OR, and XOR operations—three fundamental bitwise operations used in competitive programming, systems optimization, and low-level algorithms. Learn to solve problems like finding unique elements in linear time, testing powers of two, and implementing efficient bitmasks for sets. Essential knowledge for interview questions and real-world performance-critical code.IntermediateCode15m
- Graph Coloring (Greedy)Assign colors to vertices such that no two adjacent vertices share the same color. The greedy approach gives an upper bound on the chromatic number.Intermediate25m
- Greedy AlgorithmsSolve scheduling and optimization problems by always making the locally optimal choice. Learn the Activity Selection Problem — the canonical greedy success — and the exchange argument that proves it optimal.IntermediateCode20m
- Interval SchedulingMaster the Merge Intervals pattern: sort by start time, then sweep once to merge every overlapping range into the minimal covering set. Shows up constantly in FAANG interviews as "Merge Intervals," "Meeting Rooms," and "Insert Interval."IntermediateCode20m
Advanced
For when the rest feels solid.
- Dijkstra's AlgorithmA popular algorithm for finding the shortest path between nodes in a graph. It handles weighted edges and guarantees the shortest path for non-negative weights.Advanced30m
- A* SearchAn informed search algorithm that uses heuristics to guide the search. It guarantees the shortest path (if heuristic is admissible) and is usually much faster than Dijkstra.Advanced30m
- Bellman-Ford AlgorithmFind shortest paths from a source to all vertices, even with negative edge weights. Can also detect negative weight cycles.Advanced30m
- Floyd-Warshall AlgorithmFind shortest paths between ALL pairs of vertices. Works with negative weights (but no negative cycles). Simple triple-nested loop.Advanced30m
- Minimum Spanning Tree (Kruskal's Algorithm)Visualize Kruskal's MST algorithm: sort all edges by weight, then greedily add the cheapest edges that don't create a cycle using Union-Find. Demonstrates why a greedy approach guarantees a minimum spanning tree on connected graphs.Advanced35m
- 0/1 Knapsack ProblemA combinatorial optimization problem: Given a set of items, each with a weight and a value, determine which items to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible.Advanced25m
- Longest Common Subsequence (LCS)Finds the longest subsequence present in both sequences (not necessarily contiguous).Advanced25m
- Segment TreeA powerful tree data structure for range queries (sum, min, max) and point/range updates in O(log n). Essential for competitive programming and advanced interview problems.Advanced45m
- Fenwick Tree (Binary Indexed Tree)A simpler, more space-efficient alternative to Segment Tree for prefix sums and point updates. Uses bit manipulation for elegant O(log n) operations.Advanced30m
- Backtracking (N-Queens)Solve complex problems by building candidates step-by-step and abandoning them ("backtracking") as soon as they fail constraints.AdvancedCode30m
- Monotonic Queue (Sliding Window Maximum)Deque-based technique to track max/min in a sliding window in O(n). Essential for Sliding Window Maximum and optimization problems.Advanced25m
- Advanced Binary Search PatternsVisualize Binary Search on Answer Space through the Koko Eating Bananas (minimize-maximum) pattern. Watch how a feasibility predicate monotonically flips as the candidate answer grows, allowing binary search to locate the optimal value. The Learn tab covers maximize-minimum, rotated arrays, and other advanced variants.AdvancedCode30m
- Bitmask DP (State Compression)Use bits to represent subset states, enabling DP over all subsets efficiently. Essential for Travelling Salesman, subset selection, and assignment problems.Advanced40m
- DP on TreesTree Dynamic Programming applies DP bottom-up through a rooted tree, processing children before parents in a post-order DFS so each subtree is solved exactly once. Because trees are acyclic, there are no overlapping subproblems across branches — each child's result is computed once and aggregated upward to its parent. Classic problems include finding the tree diameter, the maximum path sum (where a path can branch through a node), and the maximum weight independent set (where chosen nodes cannot be adjacent). This visualization animates the Maximum Path Sum algorithm on a five-node binary tree, showing how each node separately tracks the best downward path to return to its parent and the best full path through itself that updates the global answer.Advanced35m
- 0-1 BFS (Deque Optimization)Shortest path when edge weights are only 0 or 1. Uses deque instead of priority queue for O(V+E) instead of O(E log V). Critical for grid problems with obstacles.Advanced25m
- Sweep Line AlgorithmProcess interval events sorted by position. Essential for meeting rooms, skyline problems, and rectangle area calculations. Often combined with TreeMap or sorted list.Advanced30m