AlgoPlusAlgoPlus
Home
Learn

Understand it first, then watch it move.

A written walkthrough for every concept — the idea, how it works, and why — each one paired with its live visualizer and the playground.

Data Structures & Algorithms

57 topics
Bubble Sort Lesson
Swap adjacent out-of-order pairs.
Selection Sort Lesson
Pick the minimum, place it at the front.
Insertion Sort Lesson
Slide each key into the sorted prefix.
Quick Sort Lesson
Partition around a pivot, recurse.
Merge Sort Lesson
Split, sort halves, merge with a buffer.
Heap Sort Lesson
Build a max-heap, extract repeatedly.
Counting Sort Lesson
Non-comparison sort by tallying counts.
Radix Sort Lesson
Sort digit by digit with stable passes.
Shell Sort Lesson
Gapped insertion sort.
Bucket Sort Lesson
Scatter values into buckets, sort each, then concatenate.
Linear Search Lesson
Scan left to right until found.
Binary Search Lesson
Halve a sorted range each step.
Jump Search Lesson
Jump in blocks, then scan.
Exponential Search Lesson
Double the bound, then binary search.
Interpolation Search Lesson
Probe by value distribution.
Stack Lesson
LIFO — push, pop, peek.
Queue Lesson
FIFO — enqueue, dequeue, front.
Linked List Lesson
Nodes chained by pointers.
Hash Table Lesson
Hash keys to buckets; chain collisions.
Deque Lesson
Double-ended queue — push/pop both ends.
Priority Queue Lesson
Heap-backed min queue (sift up/down).
Binary Search Tree Lesson
Build, traverse, and search a BST.
AVL Tree Lesson
Self-balancing BST with rotations.
Heap (Binary) Lesson
Complete tree with the heap property.
Trie Lesson
Prefix tree for strings.
Segment Tree Lesson
Range queries over array slices.
Red-Black Tree Lesson
Self-balancing BST kept in shape by recoloring and rotations.
B-Tree Lesson
Balanced multi-way search tree that splits and rebalances on insert.
Binomial Heap Lesson
Mergeable heap built from binomial trees.
Fibonacci Heap Lesson
Lazy mergeable heap with O(1) amortized decrease-key.
Breadth-First Search Lesson
Explore layer by layer (FIFO queue).
Depth-First Search Lesson
Dive deep, backtrack (call stack).
Dijkstra Lesson
Shortest paths with a priority queue.
A* Search Lesson
Heuristic-guided shortest path.
Prim's MST Lesson
Grow a tree by cheapest frontier edge.
Kruskal's MST Lesson
Sort edges, union-find to avoid cycles.
Topological Sort Lesson
Order a DAG by dependencies (Kahn's).
Bellman-Ford Lesson
Shortest paths with negative edges.
Floyd-Warshall Lesson
All-pairs shortest paths.
Strongly Connected Components Lesson
Collapse cycles into components (Kosaraju & Tarjan).
Coin Change Lesson
Fill a table, reuse subproblems for the fewest coins.
Longest Common Subsequence Lesson
Align two sequences by filling a grid.
Matrix Chain Multiplication Lesson
Parenthesize a product chain for the fewest multiplications.
0/1 Knapsack Lesson
Maximize value under a weight budget via a DP table.
Assembly Line Scheduling Lesson
Fastest path through two parallel assembly lines.
Travelling Salesman (Held-Karp) Lesson
Shortest tour over all cities via bitmask DP.
Activity Selection Lesson
Pick the most non-overlapping activities greedily.
Fractional Knapsack Lesson
Take the highest value-per-weight items first.
Huffman Coding Lesson
Build an optimal prefix code from a frequency heap.
Backtracking (N-Queens) Lesson
Explore the decision tree, prune dead ends.
0/1 Knapsack (Branch & Bound) Lesson
Prune the search tree using optimistic bounds.
Travelling Salesman (Branch & Bound) Lesson
Bound partial tours to cut the search space.
Naïve String Matching Lesson
Slide the pattern and compare at every shift.
Rabin-Karp Lesson
Find matches fast with a rolling hash.
Knuth-Morris-Pratt (KMP) Lesson
Skip ahead using the prefix (failure) table.
Finite Automaton Matching Lesson
Preprocess the pattern into a DFA, then scan once.
Playground Visual
Write plain code and watch it animate.

Problem-Solving Patterns

14 topics
Recursion Lesson
The call tree unfolds and folds (Fibonacci).
Dynamic Programming Lesson
Fill a table, reuse subproblems (coin change).
Sliding Window Lesson
A window slides across the array, no re-scan.
Backtracking Lesson
Explore the decision tree, prune dead ends (N-Queens).
Two Pointers Lesson
Converging pointers on a sorted array (pair sum).
Greedy Lesson
Take the locally best choice each step (activity selection).
Kadane's Algorithm Lesson
Maximum-sum contiguous subarray in one pass.
Cyclic Sort Lesson
Sort 1..n in place by swapping each value home.
Merge Intervals Lesson
Sort by start, fuse overlapping intervals.
Prefix Sums Lesson
Precompute totals; range sum in O(1).
Monotonic Stack Lesson
Next greater element via a decreasing stack.
Fast & Slow Pointers Lesson
Cycle detection (tortoise and hare).
Bit Manipulation Lesson
Count set bits with n & (n−1).
Binary Search on Answer Lesson
Search a monotonic answer space (integer √).

System Design

13 topics
Load Balancing Lesson
Route requests across servers by strategy.
Caching & LRU Lesson
Hits, misses, and least-recently-used eviction.
Rate Limiting Lesson
Token bucket absorbs bursts, then throttles.
Sharding & Consistent Hashing Lesson
Spread data across nodes on a hash ring.
Replication Lesson
Leader / follower, failover, read replicas.
Message Queues Lesson
Producers, consumers, backpressure.
CDN & Edge Lesson
Serve content from the nearest location.
News Feed (Twitter) Lesson
Home timelines — fan-out on write vs read.
Instagram Lesson
Photo upload, media pipeline, and feed.
Chat (WhatsApp) Lesson
Erlang/OTP — real-time, store-and-forward, E2EE.
Ride-Sharing (Uber) Lesson
H3 hexagons match riders & drivers in real time.
URL Shortener (Bitly) Lesson
Sync shorten, async analytics (NSQ), Z Proxy.
Web Search (Google) Lesson
Crawl, inverted index, PageRank + signals.

Operating Systems

20 topics
Operating System Basics Lesson
What an OS is: kernel, the user/kernel boundary, history.
Types of OS Lesson
Batch, time-sharing, real-time, multiprogramming, distributed.
System Calls & Services Lesson
User → kernel trap; OS services and system programs.
Virtual Machines Lesson
The virtual-machine abstraction and hypervisors.
Process vs Thread Lesson
Process concept, the PCB, and threads of execution.
Process States Lesson
New → Ready → Running → Waiting → Terminated.
CPU Scheduling Lesson
FCFS, SJF, Round-Robin on a Gantt chart.
Mutex / Semaphore Lesson
Threads queue on the critical section.
Classical Sync Problems Lesson
Producer-consumer, readers-writers, dining philosophers.
Deadlock Lesson
A cycle in the resource-allocation graph.
Banker's Algorithm Lesson
Deadlock avoidance via safe sequences.
Memory Paging Lesson
Virtual → physical translation and page faults.
Allocation & Fragmentation Lesson
Contiguous allocation; internal vs external fragmentation.
Segmentation Lesson
Segment tables and logical address spaces.
Page Replacement Lesson
FIFO, LRU, Optimal, Clock; frames and faults.
File Allocation Lesson
Contiguous, linked, and indexed allocation.
Directory & Free Space Lesson
Directory structures and free-space management.
Disk Scheduling Lesson
FCFS, SSTF, SCAN, C-SCAN, LOOK seek paths.
Linux Basics Lesson
History, architecture, the shell, and file structure.
Linux Commands Lesson
Essential commands and the filesystem hierarchy.

Networking & Distributed

19 topics
OSI & TCP/IP Model Lesson
Watch data get encapsulated layer by layer.
Network Topologies Lesson
Bus, star, ring, and mesh — how nodes connect.
Parity & Checksum Lesson
Catch bit errors with parity and a checksum.
CRC Lesson
Cyclic redundancy check by polynomial division.
Hamming Code Lesson
Place parity bits to detect and correct a bit flip.
Stop-and-Wait ARQ Lesson
Send one frame, wait for its ACK, repeat.
Go-Back-N ARQ Lesson
A sliding window; on loss, resend from N.
Selective Repeat ARQ Lesson
Buffer out-of-order frames, resend only the lost one.
ALOHA (Pure & Slotted) Lesson
Random access — collisions and retransmissions.
CSMA/CD (Ethernet) Lesson
Listen before talking; detect and back off on collision.
IP Addressing & Subnetting Lesson
Split an address block into subnets with masks.
Distance Vector Routing Lesson
Routers swap tables; Bellman-Ford converges.
Link State Routing Lesson
Flood the map, then Dijkstra the shortest paths.
TCP 3-Way Handshake Lesson
SYN, SYN-ACK, ACK on a sequence diagram.
TCP Congestion Control Lesson
Slow start, AIMD, and the congestion window.
DNS Resolution Lesson
Resolve a name: root → TLD → authoritative.
Diffie-Hellman Key Exchange Lesson
Two parties agree a shared secret in the open.
Raft Consensus Lesson
Leader election and log replication.
Lamport & Vector Clocks Lesson
Order events without a shared clock.

Databases

17 topics
DBMS Architecture Lesson
The 3-schema architecture and data independence.
ER Model Lesson
Entities, relationships, cardinality, and ER → tables.
Keys Lesson
Super, candidate, primary, and foreign keys.
Generalization & Aggregation Lesson
Abstraction in the extended ER model.
Relational Algebra Lesson
σ, π, ⋈, ∪, − — the operators behind SQL.
CRUD & SQL Queries Lesson
INSERT, SELECT, UPDATE, DELETE on a live table.
SQL Joins Lesson
Inner, left, right, full, and cross joins.
Integrity Constraints Lesson
Entity and referential integrity.
Query Plan Lesson
Operators execute bottom-up.
Functional Dependencies Lesson
FDs, attribute closure, canonical cover.
Normalization Lesson
1NF → 2NF → 3NF → BCNF decomposition.
B-Tree Index Lesson
Splits and rebalances as rows insert.
Transactions / MVCC Lesson
Concurrent reads and writes, isolation.
Schedules & Serializability Lesson
Conflict serializability via the precedence graph.
Recovery & Logging Lesson
Undo/redo logs, checkpoints, deadlock handling.
Two-Phase Locking Lesson
Growing and shrinking lock phases (2PL).
Timestamp Ordering Lesson
Timestamp-based concurrency control.

Machine Learning

36 topics
Linear Regression Lesson
Fit a line by minimizing squared error with gradient descent.
Logistic Regression Lesson
A sigmoid squashes a linear score into a class probability.
Gradient Descent Lesson
Roll downhill on the loss surface to find the minimum.
k-Nearest Neighbors Lesson
Classify by the majority vote of the closest points.
Naive Bayes Lesson
Classify with Bayes' rule assuming features are independent.
Decision Tree Lesson
Split the data on the most informative feature, recursively.
Random Forest Lesson
Many decorrelated trees vote for a robust prediction.
Support Vector Machine Lesson
Find the maximum-margin separating hyperplane.
K-Means Clustering Lesson
Group points around k moving centroids.
PCA Lesson
Project data onto the directions of greatest variance.
Perceptron Lesson
The original neuron — a learned linear threshold classifier.
Multilayer Perceptron Lesson
Stacked layers of neurons learn non-linear functions.
Activation Functions Lesson
Sigmoid, tanh, ReLU, and softmax add non-linearity.
Backpropagation Lesson
The chain rule sends error gradients backward through the net.
Optimizers (SGD & Adam) Lesson
How gradients become weight updates — momentum, Adam.
Regularization & Dropout Lesson
Fight overfitting with L2, dropout, and early stopping.
Convolutional Neural Network Lesson
Filters slide over an image to detect features.
Recurrent Neural Network Lesson
A hidden state carries context across a sequence.
LSTM & GRU Lesson
Gated memory cells learn long-range dependencies.
Autoencoder Lesson
Compress to a bottleneck, then reconstruct the input.
Generative Adversarial Network Lesson
A generator and discriminator train against each other.
Word Embeddings Lesson
Map words to vectors where meaning is geometry.
Attention Mechanism Lesson
Weight every input by how relevant it is right now.
Self-Attention & Multi-Head Lesson
Tokens attend to each other in parallel heads.
Positional Encoding Lesson
Inject order into a permutation-invariant model.
Transformer Architecture Lesson
Attention + feed-forward blocks, the modern backbone.
Tokenization (BPE) Lesson
Split text into subword tokens via byte-pair encoding.
Language Modeling Lesson
Predict the next token from the ones before it.
Sampling & Decoding Lesson
Temperature, top-k, and top-p shape what the model says.
GPT (Decoder-Only LLM) Lesson
Masked self-attention stacks predict text left-to-right.
Fine-tuning & RLHF Lesson
Adapt a base model, then align it with human feedback.
Retrieval-Augmented Generation Lesson
Fetch relevant documents, then condition the answer on them.
Diffusion Models Lesson
Generate images by learning to denoise pure noise.
Markov Decision Process Lesson
States, actions, rewards — the framework for RL.
Q-Learning Lesson
Learn action values from trial-and-error to act optimally.
Policy Gradient Lesson
Directly optimize the policy by following reward gradients.

Computer Architecture

17 topics
Number Representation Lesson
Two's complement and IEEE 754 floating point.
Von Neumann Architecture Lesson
Stored-program model: CPU, memory, and the bus.
Digital Logic & Gates Lesson
Boolean algebra, logic gates, and multiplexers.
Instruction Set (ISA) Lesson
Instruction formats; RISC vs CISC.
Addressing Modes Lesson
Immediate, direct, indirect, indexed, register.
Instruction Cycle Lesson
Fetch -> decode -> execute -> write-back.
CPU Datapath & Registers Lesson
ALU, control unit, register file, and buses.
Binary Addition Lesson
Ripple-carry adder and carry propagation.
Booth's Multiplication Lesson
Signed multiplication by add and shift.
Binary Division Lesson
Restoring and non-restoring division.
Control Unit Lesson
Hardwired vs microprogrammed control.
Instruction Pipeline Lesson
5-stage pipeline: hazards, stalls, and forwarding.
Memory Hierarchy Lesson
Registers -> cache -> RAM -> disk.
Cache Mapping Lesson
Direct, set-associative, and fully associative.
Virtual Memory & TLB Lesson
Address translation and the TLB.
I/O & DMA Lesson
Programmed, interrupt-driven, and DMA transfer.
Flynn's Taxonomy Lesson
SISD, SIMD, MISD, MIMD parallelism.

Web & the Browser

8 topics
Rendering Pipeline Lesson
How a browser turns HTML & CSS into pixels.
URL → Pixels Lesson
The full page-load waterfall, from DNS to first paint.
How a Browser Works Lesson
The multi-process model and the JavaScript event loop.
Search Engine: Crawl, Index, Rank Lesson
How a search engine finds pages and orders them with PageRank.
HTTP Caching Lesson
How the browser avoids re-downloading things.
Core Web Vitals Lesson
LCP, CLS, and INP — the three metrics Google uses to grade page experience.
Cookies, Sessions & Login Lesson
How a site remembers you across stateless requests.
How HTTPS Keeps a Page Safe Lesson
The padlock: certificates and the TLS handshake (see also Networking).