Full visual lab

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.

Visual lab

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.

Module 1 · Arrays

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 Introduction

First Bad Version

Watch a Range class halve the versions until start meets end, then race it against a linear search.

Module 2 · Binary Search Introduction

Search 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 Introduction

Find 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 Application

Koko 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 Application

Painter's Partition

Search the possible time limits, handing boards out to painters to test each guess.

Module 2 · Common Mistakes

Binary 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 Operations

Design 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 Operations

Middle 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 Questions

Reverse Linked List

Three pointers walk the list and turn every link around, until the old tail is the new head.

Module 3 · Linked List Questions

Merge 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 Questions

Reverse Nodes in k-Group

Cut a group off, turn its links around with three pointers, and stitch it back between its neighbours.

Module 4 · Hashing

Hashing Operations

Hash a key to its bucket, chain the collisions, then search, delete and iterate — and see why it's O(1).

Module 4 · Hashing

Two Sum

One pass with a HashMap of values seen so far — next to the brute-force double loop.

Module 4 · Hashing

Sort Array by Increasing Frequency

Count with a HashMap, sort the counts, and watch the cards slide into order.

Module 4 · Hashing

Subarray Sum Equals K

Prefix sums in a HashMap: each match lights up the subarray it found.

Module 4 · Hashing

Count Unique Characters of All Substrings

Each letter's previous and next copy bound the substrings it's unique in.

Module 5 · Heap Tree Implementation

Heap 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 Implementation

Heap Operations

Insert bubbles up, pop min sinks down — watch the tree and the array behind it move together.

Module 5 · Heap Tree Implementation

Sort an Array

Heap sort with the course's Heap class: add everything, then poll the root until it's empty.

Module 5 · Applications of Heap

Kth Largest Element in an Array

A min heap of the k largest so far — its root is the answer.

Module 5 · Applications of Heap

Top K Frequent Elements

Count with a HashMap, then keep the k most frequent in a min heap by frequency.

Module 5 · Applications of Heap

Find Median from Data Stream

Two heaps meeting in the middle: the median is always at their tops.

Module 6 · Stacks Introduction

Stack Operations

A stack on an array: push, pop and peek just move one top index — every operation O(1).

Module 6 · Stack Applications

Backspace String Compare

Type each string into a stack — letters push, # pops — then compare what's left.

Module 6 · Stack Applications

Closest 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 Applications

Largest 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 Ranges

Sum 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 Ranges

Sum of Subarray Ranges

Every subarray's maximum minus every subarray's minimum — two contribution passes with a stack.

Module 6 · Queues

Queue Operations

A queue on a circular array: enqueue at the rear, dequeue at the front, both wrapping around — every operation O(1).

Module 6 · Queues

Sliding Window Maximum

A monotonic deque of max candidates: smaller values leave from the back, expired ones from the front.

Module 7 · Sliding Window Intro

Contains 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 Intro

Longest Substring Without Repeating Characters

Grow while no character repeats, measure, then shrink until the repeat leaves.

Module 7 · Sliding Window Intro

Max Consecutive Ones III

The longest window with at most k zeros to flip — grow, measure, shrink until a zero leaves.

Module 7 · Sliding Window Advanced

Smallest 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 Advanced

Minimum Window Substring

Match every character of t with counts, then shrink while still matched — the smallest window holding t.

Module 7 · Sliding Window Advanced

Count 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 Advanced

Maximum 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–Exclusion

Subset Sum

Leave or take each number — the inclusion–exclusion tree grows call by call, then shows the numbers it picked.

Module 10 · DP: Inclusion–Exclusion

0-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–Exclusion

Number 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–Exclusion

Longest Common Subsequence

Match, or drop a character from either string — the decision tree spells out the subsequence it finds.

Module 10 · DP: Inclusion–Exclusion

Longest Increasing Subsequence

dp[i] is the longest increasing run ending at i — extend the best smaller one before it.

Module 10 · Matrix Chain Multiplication

Matrix Multiplication Basics

One element, two matrices, a chain — how many multiplications each split costs, and the ranges that repeat.

Module 10 · Matrix Chain Multiplication

Matrix 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 Trees

Basics 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 Tree

Binary Tree Inorder Traversal

Left, node, right: watch the recursion go down the left side and the call stack wait for it.

Module 8 · Binary Tree

Binary Tree Level Order Traversal

A queue that holds exactly one level each time a level starts.

Module 8 · Binary Tree

Insert 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 Tree

Lowest Common Ancestor

Each call reports p, q or null; the first node that hears from both sides is the answer.

Module 8 · Binary Tree

Validate Binary Search Tree

Bottom up: every subtree reports its [min, max], and each node checks both sides.

Module 8 · Binary Tree

Construct from Preorder and Inorder

Preorder names the root, inorder splits the range: the tree fills in node by node.

Module 8 · Binary Tree

Serialize and Deserialize Binary Tree

Write the tree level by level with N for missing children, then read it back.

Module 8 · BFS on Graph

Breadth-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 Graph

Find 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 Graph

Shortest Path in Undirected Graph

BFS one level at a time: the level where the destination is polled is its distance.

Module 8 · BFS on Graph

Undirected Graph Cycle

Skip the edge you came along; any other visited neighbour means a second way round. DFS or BFS.

Module 8 · Topological Sorting

Course 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 Sorting

Directed Graph Cycle

Three colours in a DFS, or in-degrees that never reach 0 in Kahn's BFS.

Module 8 · BFS on Grid

Find Whether Path Exist

A grid is a graph: BFS from the source cell through open cells, around the walls.

Module 8 · BFS on Grid

Number of Islands

Scan the grid; every unvisited land cell starts a BFS that sinks its whole island.

Module 8 · BFS on Grid

Rotting Oranges

Every rotten orange starts in the queue at once; each level of the queue is one minute.

Module 8 · Union Find and MST

Union Find Basics

find, union and isSame on a forest: first plain, then with path compression and union by rank.

Module 8 · Union Find and MST

Number of Connected Components

Every edge that joins two different roots removes one component.

Module 8 · Union Find and MST

Redundant Connection

The edge whose ends already share a root is the one that closes the cycle.

Module 8 · Union Find and MST

Minimum Spanning Tree

Kruskal: lightest edge first, skipping any edge whose ends are already connected.

Module 8 · Dijkstra on Graph

Minimum 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 · Trie

Trie Operations

insert, search and startsWith: walk down one letter per node.

Module 11 · Trie

Matching and Deletion in Trie

match with '.' tries every child; delete prunes the nodes no other word needs.

Module 11 · Trie

Search Suggestions System

One step down per letter typed, then a depth-first walk collects three words in order.

Module 11 · Trie

Count of Distinct Substrings

Insert every suffix: each new node is a new distinct substring.

Module 11 · Trie

Maximum XOR of Two Numbers

A trie of bits: take the opposite bit whenever it exists.

Module 15 · Two Pointers

Triplet Sum in Array

Sort, fix one number, and close left and right in on the two that reach the target.

Module 15 · Two Pointers

Triplets 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 Pointers

Triplets with Sum in Given Range

Sums below R + 1 minus sums below L: the smaller-sum count, run twice.

Module 15 · Two Pointers

Valid Triangle Number

Fix the longest side and count every pair below it that beats it, many at once.

Full course

The full visual lab

Every lesson's visual, from graphs and Dijkstra to DP and tries — open to enrolled students.

Library

Component Showcase

Every building block — arrays, pointers, windows, linked lists, trees, graphs, grids, stacks, queues and annotations.