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 here

    Beginner topics, in the order they build on each other.

    1. 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
    2. Arrays & ListsMaster the most fundamental data structure - arrays and lists. Learn about random access, sequential operations, and memory layout.Beginner15m
    3. Linked ListA linear data structure where elements are not stored at contiguous memory locations. The elements are linked using pointers.Beginner15m
    4. Stack Data StructureUnderstand the Last-In-First-Out (LIFO) principle. Visualize Push, Pop, and Peek operations.BeginnerCode15m
    5. Queue Data StructureUnderstand the First-In-First-Out (FIFO) principle. Visualize Enqueue and Dequeue operations.Beginner15m
    6. Binary SearchUnderstand the power of O(log n). Visualize dividing the search space in half to find targets in sorted arrays instantly.BeginnerCode15m
    7. 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
    8. 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
    9. 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
    10. 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
    11. 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
    12. 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.

    1. 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
    2. Quick SortA highly efficient Divide and Conquer algorithm. It picks an element as pivot and partitions the given array around the picked pivot.Intermediate20m
    3. 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
    4. 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
    5. 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
    6. 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
    7. 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
    8. 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
    9. Topological SortOrder tasks with dependencies! Visualize Kahn's Algorithm using In-Degrees. Crucial for build systems, course scheduling, and resolving dependencies.IntermediateCode25m
    10. 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
    11. Trie (Prefix Tree)Optimize prefix-based searches! Visualize how words are stored as a tree of characters. Key for autocomplete and spell checkers.IntermediateCode20m
    12. Union-Find (Disjoint Set)Master the Union-Find data structure. Essential for Kruskal's Algorithm, connected components, and cycle detection in undirected graphs.IntermediateCode20m
    13. 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
    14. 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
    15. 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
    16. 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
    17. 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
    18. 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
    19. 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
    20. 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.

    1. 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
    2. 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
    3. Bellman-Ford AlgorithmFind shortest paths from a source to all vertices, even with negative edge weights. Can also detect negative weight cycles.Advanced30m
    4. Floyd-Warshall AlgorithmFind shortest paths between ALL pairs of vertices. Works with negative weights (but no negative cycles). Simple triple-nested loop.Advanced30m
    5. 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
    6. 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
    7. Longest Common Subsequence (LCS)Finds the longest subsequence present in both sequences (not necessarily contiguous).Advanced25m
    8. 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
    9. 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
    10. Backtracking (N-Queens)Solve complex problems by building candidates step-by-step and abandoning them ("backtracking") as soon as they fail constraints.AdvancedCode30m
    11. 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
    12. 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
    13. 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
    14. 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
    15. 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
    16. 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

    Learn it as part of a path

    Related topics