Unlock every animation for ₹3,999 ₹2,799
The free demos below are a taste. The full lab opens every lesson's visual, from linked lists to DP and graphs, for 365 days, plus every new demo we add. Videos come with the full course.
See every step. Control every move.
Interactive animations that walk through data structures and algorithms one step at a time. Play, pause, step back and forth, and follow the Java code and variables as they change.
Array Operations
Read, replace, insert and delete — watch each element shift and see why some operations are O(1) and others O(n).
Module 2 · Binary Search IntroductionFirst Bad Version
Watch a Range class halve the versions until start meets end, then race it against a linear search.
Module 2 · Binary Search IntroductionSearch Insert Position
Find where a target is, or where it would go, in a sorted array — with the same Range class.
Module 2 · Binary Search IntroductionFind First and Last Position
One binary search run twice: for the target, then for target + 1, to find both ends of a block of repeats.
Module 2 · Binary Search ApplicationKoko Eating Bananas
Binary search on the answer: try speeds on a number line and add up the hours pile by pile.
Module 2 · Binary Search ApplicationPainter's Partition
Search the possible time limits, handing boards out to painters to test each guess.
Module 2 · Common MistakesBinary Search: Common Mistakes
A range that stops shrinking, a loop that runs once too often, a step that drops the answer: watch each one break, then the fix.
Module 3 · Linked List Implementation and OperationsDesign Linked List
A dummy head and two helpers behind get, addAtHead, addAtTail, addAtIndex and deleteAtIndex — watch every pointer change.
Module 3 · Linked List Implementation and OperationsMiddle of the Linked List
Fast and slow pointers: fast takes two steps for every one of slow, so slow stops on the middle.
Module 3 · Linked List QuestionsReverse Linked List
Three pointers walk the list and turn every link around, until the old tail is the new head.
Module 3 · Linked List QuestionsMerge k Sorted Lists
Watch nodes slide out of k lists into one, always the smallest first, picked by a priority queue.
Module 3 · Linked List QuestionsReverse Nodes in k-Group
Cut a group off, turn its links around with three pointers, and stitch it back between its neighbours.
Module 4 · HashingHashing Operations
Hash a key to its bucket, chain the collisions, then search, delete and iterate — and see why it's O(1).
Module 4 · HashingTwo Sum
One pass with a HashMap of values seen so far — next to the brute-force double loop.
Module 4 · HashingSort Array by Increasing Frequency
Count with a HashMap, sort the counts, and watch the cards slide into order.
Module 4 · HashingSubarray Sum Equals K
Prefix sums in a HashMap: each match lights up the subarray it found.
Module 4 · HashingCount Unique Characters of All Substrings
Each letter's previous and next copy bound the substrings it's unique in.
Module 5 · Heap Tree ImplementationHeap Tree as an Array
Arrows from every tree node to its array cell, then the parent and child formulas worked on any node.
Module 5 · Heap Tree ImplementationHeap Operations
Insert bubbles up, pop min sinks down — watch the tree and the array behind it move together.
Module 5 · Heap Tree ImplementationSort an Array
Heap sort with the course's Heap class: add everything, then poll the root until it's empty.
Module 5 · Applications of HeapKth Largest Element in an Array
A min heap of the k largest so far — its root is the answer.
Module 5 · Applications of HeapTop K Frequent Elements
Count with a HashMap, then keep the k most frequent in a min heap by frequency.
Module 5 · Applications of HeapFind Median from Data Stream
Two heaps meeting in the middle: the median is always at their tops.
Module 6 · Stacks IntroductionStack Operations
A stack on an array: push, pop and peek just move one top index — every operation O(1).
Module 6 · Stack ApplicationsBackspace String Compare
Type each string into a stack — letters push, # pops — then compare what's left.
Module 6 · Stack ApplicationsClosest Smaller on Left
The monotonic stack pattern: pop what can never be the answer, and the top is the closest smaller value.
Module 6 · Stack ApplicationsLargest Rectangle in Histogram
The closest smaller bar on both sides of every bar, from one stack pass — then each bar's widest rectangle.
Module 6 · Sum of Subarray RangesSum of Subarray Minimums
Count how many subarrays each value is the minimum of, with the closest smaller value on each side.
Module 6 · Sum of Subarray RangesSum of Subarray Ranges
Every subarray's maximum minus every subarray's minimum — two contribution passes with a stack.
Module 6 · QueuesQueue Operations
A queue on a circular array: enqueue at the rear, dequeue at the front, both wrapping around — every operation O(1).
Module 6 · QueuesSliding Window Maximum
A monotonic deque of max candidates: smaller values leave from the back, expired ones from the front.
Module 7 · Sliding Window IntroContains Duplicate II
A window of the last k indices: each value's last index says in O(1) whether it repeats nearby.
Module 7 · Sliding Window IntroLongest Substring Without Repeating Characters
Grow while no character repeats, measure, then shrink until the repeat leaves.
Module 7 · Sliding Window IntroMax Consecutive Ones III
The longest window with at most k zeros to flip — grow, measure, shrink until a zero leaves.
Module 7 · Sliding Window AdvancedSmallest Distinct Window
Grow until every distinct character is in, shrink while it stays good — the smallest window that has them all.
Module 7 · Sliding Window AdvancedMinimum Window Substring
Match every character of t with counts, then shrink while still matched — the smallest window holding t.
Module 7 · Sliding Window AdvancedCount the Number of Good Subarrays
Grow until the window has k equal pairs, then count every longer subarray starting at left in one step.
Module 7 · Sliding Window AdvancedMaximum Number of Occurrences of a Substring
A fixed window of minSize: last indexes give the distinct count, a map counts every window within maxLetters.
Module 10 · DP: Inclusion–ExclusionSubset Sum
Leave or take each number — the inclusion–exclusion tree grows call by call, then shows the numbers it picked.
Module 10 · DP: Inclusion–Exclusion0-1 Knapsack
Leave or take each item while it fits — the tree, the best value under every call, and the items it picks.
Module 10 · DP: Inclusion–ExclusionNumber of Coins
Take a coin again or skip it — the decision tree, -1 for sums that can't be made, and the coins it picked.
Module 10 · DP: Inclusion–ExclusionLongest Common Subsequence
Match, or drop a character from either string — the decision tree spells out the subsequence it finds.
Module 10 · DP: Inclusion–ExclusionLongest Increasing Subsequence
dp[i] is the longest increasing run ending at i — extend the best smaller one before it.
Module 10 · Matrix Chain MultiplicationMatrix Multiplication Basics
One element, two matrices, a chain — how many multiplications each split costs, and the ranges that repeat.
Module 10 · Matrix Chain MultiplicationMatrix Chain Multiplication
Every running call is a box around its matrices, nested inside its caller's — ending with the cheapest bracketing.
Module 8 · Basics of Graphs and TreesBasics of Graphs
Degree, paths, cycles, distance and the types of graphs, then one graph turned into a binary search tree, one restriction at a time.
Module 8 · Binary TreeBinary Tree Inorder Traversal
Left, node, right: watch the recursion go down the left side and the call stack wait for it.
Module 8 · Binary TreeBinary Tree Level Order Traversal
A queue that holds exactly one level each time a level starts.
Module 8 · Binary TreeInsert into a Binary Search Tree
Walk down from the root, one comparison per level, to the one empty spot the value fits.
Module 8 · Binary TreeLowest Common Ancestor
Each call reports p, q or null; the first node that hears from both sides is the answer.
Module 8 · Binary TreeValidate Binary Search Tree
Bottom up: every subtree reports its [min, max], and each node checks both sides.
Module 8 · Binary TreeConstruct from Preorder and Inorder
Preorder names the root, inorder splits the range: the tree fills in node by node.
Module 8 · Binary TreeSerialize and Deserialize Binary Tree
Write the tree level by level with N for missing children, then read it back.
Module 8 · BFS on GraphBreadth-First Search
Follow BFS level by level with the queue, the visited set and the traversal order — on graphs with cycles and disconnected parts.
Module 8 · BFS on GraphFind if Path Exists in Graph
Spread from the source with a queue, or dive with recursion: switch between BFS and DFS on the same graph.
Module 8 · BFS on GraphShortest Path in Undirected Graph
BFS one level at a time: the level where the destination is polled is its distance.
Module 8 · BFS on GraphUndirected Graph Cycle
Skip the edge you came along; any other visited neighbour means a second way round. DFS or BFS.
Module 8 · Topological SortingCourse Schedule II
Order courses so every prerequisite comes first: Kahn's BFS or a colour DFS, and why a cycle makes it impossible.
Module 8 · Topological SortingDirected Graph Cycle
Three colours in a DFS, or in-degrees that never reach 0 in Kahn's BFS.
Module 8 · BFS on GridFind Whether Path Exist
A grid is a graph: BFS from the source cell through open cells, around the walls.
Module 8 · BFS on GridNumber of Islands
Scan the grid; every unvisited land cell starts a BFS that sinks its whole island.
Module 8 · BFS on GridRotting Oranges
Every rotten orange starts in the queue at once; each level of the queue is one minute.
Module 8 · Union Find and MSTUnion Find Basics
find, union and isSame on a forest: first plain, then with path compression and union by rank.
Module 8 · Union Find and MSTNumber of Connected Components
Every edge that joins two different roots removes one component.
Module 8 · Union Find and MSTRedundant Connection
The edge whose ends already share a root is the one that closes the cycle.
Module 8 · Union Find and MSTMinimum Spanning Tree
Kruskal: lightest edge first, skipping any edge whose ends are already connected.
Module 8 · Dijkstra on GraphMinimum Cost Path
Dijkstra on a grid — watch cells fly into the priority queue, get polled from the front and settle their minimum cost.
Module 11 · TrieTrie Operations
insert, search and startsWith: walk down one letter per node.
Module 11 · TrieMatching and Deletion in Trie
match with '.' tries every child; delete prunes the nodes no other word needs.
Module 11 · TrieSearch Suggestions System
One step down per letter typed, then a depth-first walk collects three words in order.
Module 11 · TrieCount of Distinct Substrings
Insert every suffix: each new node is a new distinct substring.
Module 11 · TrieMaximum XOR of Two Numbers
A trie of bits: take the opposite bit whenever it exists.
Module 15 · Two PointersTriplet Sum in Array
Sort, fix one number, and close left and right in on the two that reach the target.
Module 15 · Two PointersTriplets with Smaller Sum
When a sum is small enough, every number between left and right works too — count them in one step.
Module 15 · Two PointersTriplets with Sum in Given Range
Sums below R + 1 minus sums below L: the smaller-sum count, run twice.
Module 15 · Two PointersValid Triangle Number
Fix the longest side and count every pair below it that beats it, many at once.
Full courseThe full visual lab
Every lesson's visual, from graphs and Dijkstra to DP and tries — open to enrolled students.
LibraryComponent Showcase
Every building block — arrays, pointers, windows, linked lists, trees, graphs, grids, stacks, queues and annotations.