AlgoDrishti — Algorithms and Data Structures
Learn with interactive visualizations and detailed theory.
Browse the encyclopediaSitemap and topic directory
Find every algorithm, its purpose, an interactive visualization, and a detailed theory guide.
DAA ConceptsCore concepts and your learning path.
DAA Concepts- DAA Concept Library
Algorithm concepts and independent learner progress.
Theory guide
Analysis & CorrectnessDerive bounds and prove why algorithms work.
Analysis & Correctness- Asymptotic Notation and Growth
Separate upper bounds, lower bounds, tight bounds and strict asymptotic domination.
Theory guide - Cases, Time and Auxiliary Space
Specify input size, cost model, case and memory before making a bound.
Theory guide - Analyzing Loops and Recursion
Turn control flow into sums and recurrences.
Theory guide - Recurrences: Substitution Method
Guess a bound and prove it inductively, including base cases.
Theory guide - Recurrences: Recursion Trees
Sum the work at each level and at the leaves.
Theory guide - Master Theorem
Compare combine work with the recursive leaf exponent.
Theory guide - Induction and Loop Invariants
Prove initialization, preservation, termination and the postcondition.
Theory guide - Greedy Choice and Exchange Arguments
Show why a local choice can belong to an optimal solution.
Theory guide - Amortized Analysis
Bound the total cost of a sequence without a probabilistic assumption.
Theory guide - Algorithms and Pseudocode
Specify input, output and termination.
Theory guide
Divide and ConquerSplit, solve, combine and analyze.
Divide and Conquer- Divide-and-Conquer Min/Max
Combine minimum and maximum from two halves.
Theory guide - Maximum Subarray
Compare the best left, right and midpoint-crossing ranges.
Theory guide - Strassen Matrix Multiplication
Multiply blocks with seven recursive products.
Theory guide - Quickselect
Partition and recurse only into the rank-containing group.
Theory guide - Median-of-Medians Selection
Use medians of groups of five for a guaranteed linear bound.
Theory guide - Divide and Conquer: Design Method
Solve smaller instances and prove the combine step.
Theory guide
Branch and BoundExplore search trees and prune with safe bounds.
Branch and Bound- 0/1 Knapsack: FIFO Branch and Bound
Use a fractional-knapsack upper bound to prune exact 0/1 search.
Theory guide - 0/1 Knapsack: Best-First Branch and Bound
Use a fractional-knapsack upper bound to prune exact 0/1 search.
Theory guide - TSP Branch and Bound
Explore partial tours by a safe outgoing-edge lower bound.
Theory guide - Branch and Bound: Method and Bounds
Separate feasible incumbents from optimistic relaxation bounds.
Theory guide
Complexity TheoryCertificates, reductions and computational limits.
Complexity Theory- P, NP, NP-Hard and NP-Complete
Use decision problems and certificates to classify computational difficulty.
Theory guide - Decision Problems, Certificates and Reductions
Translate instances while preserving yes/no answers.
Theory guide - Worked Reduction: 3-SAT → Clique
Construct one candidate literal vertex per clause occurrence.
Theory guide - Worked Reduction: Clique → Vertex Cover
Complement a graph and invert the selected vertex set.
Theory guide - Cook–Levin Theorem Overview
Understand why SAT became the starting NP-complete problem.
Theory guide
DAA ExtensionsAdvanced algorithm concepts and techniques.
DAA Extensions- Ford–Fulkerson / Edmonds–Karp
Use BFS residual augmenting paths; expose a minimum cut.
Theory guide - Bipartite Matching
Increase a matching through augmenting paths.
Theory guide - Graph Bridges
Track DFS discovery times and lowlink values.
Theory guide - Articulation Points
Track DFS discovery times and lowlink values.
Theory guide - Eulerian Trail
Hierholzer’s edge-consuming traversal.
Theory guide - Counting Inversions
Count cross inversions while merging sorted halves.
Theory guide - Closest Pair of Points
Divide by x, then inspect a y-sorted midpoint strip.
Theory guide - Karatsuba Multiplication
Multiply integers with three recursive products.
Theory guide - Randomized Quicksort
Use reproducible pseudorandom pivots and three-way partitions.
Theory guide - Randomized Selection
Choose seeded pivots for selection.
Theory guide - Vertex Cover 2-Approximation
Take both endpoints of each uncovered edge.
Theory guide - Metric TSP 2-Approximation
Shortcut a doubled MST using preorder.
Theory guide - Boyer–Moore: Bad-Character Rule
Compare from the pattern’s end and skip incompatible alignments.
Theory guide - Suffix Array
Sort suffix starts lexicographically.
Theory guide - Reliability Design DP
Allocate independent parallel copies to a series system.
Theory guide - FFT / Discrete Fourier Transform
Radix-2 FFT computes the forward DFT.
Theory guide - Bin Packing: First Fit Decreasing
Pack descending-size items into the first feasible bin.
Theory guide - Expected and Randomized Analysis
Specify the source of randomness and analyze with indicator variables.
Theory guide - Linear Programming Introduction
Model a linear objective and linear constraints; connect relaxation to bounds.
Theory guide - Approximation Algorithms and Guarantees
Prove feasibility and a worst-case ratio.
Theory guide
SortingWatch comparisons, swaps, partitions, merges, heaps, buckets, and gap passes.
Sorting- Bubble Sort
Repeated adjacent comparisons move large values to the sorted suffix.
Theory guide - Selection Sort
Selects the minimum remaining value and moves it into place.
Theory guide - Insertion Sort
Builds a sorted prefix one inserted value at a time.
Theory guide - Binary Insertion Sort
Uses binary search to find each insertion point, then shifts values into place.
Theory guide - Merge Sort
Splits the array and merges sorted halves.
Theory guide - Quick Sort
Partitions around a pivot and recursively sorts both sides.
Theory guide - Heap Sort
Builds a heap, then repeatedly extracts the maximum.
Theory guide - Counting Sort
Counts small integer values, then writes them back in order.
Theory guide - Radix Sort
Sorts integers digit by digit using stable buckets.
Theory guide - Shell Sort
Sorts distant elements first, shrinking the gap until it becomes insertion sort.
Theory guide - Cocktail Shaker Sort
Bubble sort in both directions, tightening the unsorted range.
Theory guide - Comb Sort
Compares elements far apart, shrinking the gap to remove small inversions early.
Theory guide - Gnome Sort
Walks forward when ordered and swaps backward when it finds an inversion.
Theory guide - Divide and Conquer Suite
Split, solve, combine pattern across merge sort, quick sort, binary search, and closest-pair style problems.
Theory guide - Advanced Sorting Suite
Bucket sort, TimSort, IntroSort, stable partitioning, and hybrid sorting strategy selection.
Theory guide
SearchingFind targets, bounds, peaks, and positions with step-by-step pointer movement.
Searching- Linear Search
Scans each element until the target is found or the array ends.
Theory guide - Sentinel Linear Search
Adds a sentinel value to remove the inner bounds check during scanning.
Theory guide - Recursive Linear Search
Searches one index per recursive call and shows the call count.
Theory guide - Binary Search
Repeatedly halves a sorted search range.
Theory guide - Recursive Binary Search
The same halving strategy with explicit recursive call-stack metrics.
Theory guide - Lower Bound
Finds the first sorted position whose value is greater than or equal to the target.
Theory guide - Upper Bound
Finds the first sorted position whose value is greater than the target.
Theory guide - First Occurrence
Uses lower bound to find the first duplicate position.
Theory guide - Last Occurrence
Uses upper bound minus one to find the last duplicate position.
Theory guide - Search Insert Position
Returns the sorted position where the target should be inserted.
Theory guide - Rotated Sorted Array Search
Finds a target while detecting which half is currently sorted.
Theory guide - Peak Element Search
Binary-search style walk toward a local peak.
Theory guide - Sliding Window / Two Pointers Suite
Fixed windows, variable windows, opposite pointers, fast/slow pointers, and partition-style scans.
Theory guide - Advanced Searching Suite
Jump search, exponential search, interpolation search, ternary search, and answer-space binary search.
Theory guide
Data StructuresInspect linear structures, hash tables, trees, heaps, tries, range-query structures, memory, and learning tools.
Data Structures- Stack
Last-in, first-out operations with push and pop.
Theory guide - Queue
First-in, first-out operations with enqueue and dequeue.
Theory guide - Tree Preorder Traversal
Visits root, then left subtree, then right subtree on a real tree diagram.
Theory guide - Tree Inorder Traversal
Visits left subtree, root, then right subtree; sorted order for BSTs.
Theory guide - Tree Postorder Traversal
Visits children before the root; useful for deletion and expression trees.
Theory guide - Tree Level Order Traversal
Visits nodes breadth-first using a queue.
Theory guide - Learning Dashboard
Central progress view for next lessons, weak areas, recent practice, and completion state.
Theory guide - Curriculum Paths
Beginner, intermediate, advanced, interview prep, DSA foundations, and competitive programming tracks.
Theory guide - Concept Lessons
Short lessons for invariants, recursion, recurrence relations, graph relaxation, and heap properties.
Theory guide - Algorithm Exercises
Algorithm-specific exercises instead of only generic quiz prompts.
Theory guide - Step Prediction Mode
Predict-next-step practice tied to actual timeline events.
Theory guide - Bug-Fix Mode
Broken pseudocode and code-line repair prompts for common algorithm mistakes.
Theory guide - Dry Run Worksheet
Fill-in worksheet for variables such as low, mid, high, i, j, and dp cells.
Theory guide - Assessment Engine
Topic quizzes, timed checks, final module tests, and mastery scores.
Theory guide - Spaced Review
Review missed concepts after one day, three days, seven days, and later intervals.
Theory guide - Hints System
Tiered hints from concept hint to formula hint to next-step hint.
Theory guide - Multi-Language Code
Language-toggle learning for TypeScript, Python, Java, and C++ implementations.
Theory guide - Code Runner Sandbox
Editable-code workflow with examples, run results, and comparison against expected output.
Theory guide - Custom Test Cases
Learner-created inputs with expected output validation and edge-case prompts.
Theory guide - Mistake Analytics
Tracks missed complexity, wrong step predictions, recurrence mistakes, and off-by-one errors.
Theory guide - Certificates and Milestones
Completion state, milestones, badges, and certificate-ready topic mastery.
Theory guide - Recursion Fundamentals Suite
Base cases, recursive cases, stack frames, divide steps, backtracking, and unwinding.
Theory guide - Interview Patterns Suite
When-to-use cards for sorted input, monotonic structures, overlapping subproblems, greedy choices, and graph frontiers.
Theory guide - Monotonic Stack / Queue Suite
Next greater element, stock span, histogram area, sliding-window maximum, and deque invariants.
Theory guide - Tree Algorithms Suite
Lowest common ancestor, tree height, diameter, subtree aggregation, serialization, and traversal-derived properties.
Theory guide - Formula and Glossary Sheet
Quick reference for complexity classes, invariants, recurrence forms, graph terms, and data-structure vocabulary.
Theory guide - Flashcards Drill Mode
Rapid recall cards for complexities, use cases, invariants, edge cases, and pattern selection.
Theory guide - Challenge Mode
Timed mixed-topic drills, streaks, mastery gates, and final-review challenge sets.
Theory guide - Progress Portability
Import and export learning progress, notes, quiz scores, saved experiments, and review queues.
Theory guide - Linked List Suite
Singly, doubly, and circular linked-list operations with pointer rewiring.
Theory guide - Hash Table Suite
Hashing, collisions, probing, chaining concepts, load factor, and rehash triggers.
Theory guide - Binary Search Tree Operations
BST insert, search, min/max, successor, predecessor, and delete cases.
Theory guide - AVL Tree Rotations
LL, RR, LR, and RL rotations with balance-factor reasoning.
Theory guide - Red-Black Tree Visualization
Red-black insert/delete fixups, rotations, recoloring, and black-height rules.
Theory guide - Heap / Priority Queue Operations
Insert, build heap, heapify, extract, and priority queue ordering.
Theory guide - Trie / Prefix Tree
Insert, search, delete, autocomplete, and prefix counting.
Theory guide - Disjoint Set Union
Union by representative with path compression and Kruskal-style connectivity.
Theory guide - Segment Tree
Range queries, point updates, and lazy propagation for interval data.
Theory guide - Fenwick Tree / Binary Indexed Tree
Prefix sums and point updates using lowbit jumps.
Theory guide - Deque and Circular Queue
Front/rear pointer operations, wraparound, overflow, and underflow.
Theory guide - Expression Trees
Infix, postfix, prefix conversion and expression evaluation through trees.
Theory guide - Skip List
Probabilistic levels for search, insert, and delete.
Theory guide - B-Tree / B+ Tree
Database-style node splits, promotions, merges, and range scans.
Theory guide - Recursion and Call Stack Visualizer
Generic stack-frame tracing for recursive algorithms and backtracking.
Theory guide - Memory Model View
Array slots, pointer references, object nodes, and stack versus heap.
Theory guide - Interactive Exercises Mode
Predict-next-step, fix-the-bug, fill-pseudocode, and output quizzes.
Theory guide - Complexity Lab
Compare step counts, reads, writes, comparisons, and memory across input sizes.
Theory guide - Custom Data Structure Builder
Manual input workflows for arrays, trees, graphs, grids, and node structures.
Theory guide - Learning Paths and Assessments
Beginner, intermediate, and advanced tracks with checkpoints and review prompts.
Theory guide
GraphsExplore traversal, shortest paths, spanning trees, topological order, and strongly connected components.
Graphs- Breadth-First Search
Traverse an editable graph by unweighted distance from a source.
Theory guide - Depth-First Search
Explore an editable graph with a stack and visited set.
Theory guide - Prerequisite Graph
Maps dependencies such as arrays to searching, recursion to trees, and graphs to shortest paths.
Theory guide - Advanced Graph Suite
Bridges, articulation points, Eulerian paths, max flow, bipartite matching, and graph coloring.
Theory guide - Graph Representation Suite
Adjacency lists, adjacency matrices, edge lists, weighted graphs, directed graphs, and input normalization.
Theory guide - Graph Shortest Paths Suite
Dijkstra, Bellman-Ford, Floyd-Warshall, and A* pathfinding concepts.
Theory guide - Graph MST Suite
Prim and Kruskal with edge choices and DSU cycle checks.
Theory guide - Topological Sort Suite
Kahn and DFS topological sorting with cycle detection.
Theory guide - Strongly Connected Components
Kosaraju and Tarjan stack/finish-time component discovery.
Theory guide - Dijkstra
Single-source shortest paths with non-negative weights.
Theory guide - Bellman–Ford
Relax paths and detect reachable negative cycles.
Theory guide - Floyd–Warshall
All-pairs shortest paths by allowed intermediate vertices.
Theory guide - Prim
Grow a minimum spanning forest using crossing edges.
Theory guide - Kruskal with DSU
Sort edges and join distinct components.
Theory guide - Kahn Topological Sort
Remove zero-indegree vertices and detect directed cycles.
Theory guide - Kosaraju SCC
Find strongly connected components with two DFS passes.
Theory guide - Disjoint Sets: Union and Find
Join components by size and compress find paths.
Theory guide - Breadth-First Search
Traverse an editable graph by unweighted distance from a source.
Theory guide - Depth-First Search
Explore an editable graph with a stack and visited set.
Theory guide
Dynamic ProgrammingBuild recurrence tables, dependency arrows, traceback paths, and memoized states.
Dynamic Programming- Trace Table Mode
Trace-table practice for DP, recursion, graph search, searching, and sorting variables.
Theory guide - Prefix Sum / Difference Suite
Prefix sums, 2D prefix sums, difference arrays, range updates, and subarray-sum patterns.
Theory guide - Dynamic Programming Suite
Fibonacci, coin change, LCS, edit distance, and knapsack-style state transitions in shared DP tables.
Theory guide - Fibonacci Memoization
Top-down recursion caches each Fibonacci state.
Theory guide - Fibonacci Tabulation
Bottom-up evaluation in dependency order.
Theory guide - Minimum Coin Change
Unbounded minimum-coin DP with solution reconstruction.
Theory guide - 0/1 Knapsack DP
Choose each item at most once, maximizing profit.
Theory guide - Longest Common Subsequence
Build a prefix table and reconstruct a common subsequence.
Theory guide - Edit Distance
Minimum unit-cost insertion, deletion and replacement.
Theory guide - Matrix-Chain Multiplication
Choose a multiplication parenthesization, without changing matrix order.
Theory guide - Optimal Binary Search Tree
Optimal BST for ordered keys with successful and unsuccessful searches.
Theory guide - Multistage DAG Shortest Path
Shortest paths in a DAG, allowing negative edges.
Theory guide - Held–Karp TSP
Exact TSP using visited-subset and final-vertex states.
Theory guide - Dynamic Programming: Design Method
Define states, transitions, bases and dependency order.
Theory guide
StringsVisualize pattern matching, rolling hashes, prefixes, suffixes, and palindromes.
Strings- String Pattern Matching Suite
KMP, Rabin-Karp, Z algorithm, prefix functions, rolling hashes, and palindrome checks.
Theory guide - Advanced String Structures
Trie, suffix array, suffix tree preview, and Aho-Corasick matching.
Theory guide - Naive String Matching
Compare the pattern at every possible text offset.
Theory guide - Knuth–Morris–Pratt
Reuse matched prefixes through failure links.
Theory guide - Rabin–Karp
Roll modular window hashes and verify equal-hash candidates.
Theory guide
Number TheoryLearn gcd, modular arithmetic, primes, totients, and RSA-supporting math.
Number Theory- Number Theory Suite
GCD, sieve, modular arithmetic, fast exponentiation, primality checks, totients, and RSA-supporting math.
Theory guide - Bit Manipulation Suite
Masks, shifts, XOR tricks, lowbit, subsets, parity, and power-of-two checks.
Theory guide
BacktrackingStep through search trees, choices, constraints, dead ends, and undo operations.
Backtracking- Backtracking Suite
N-Queens, subset sums, graph coloring, and Hamiltonian cycles with recursive choices, rejection checks, and undo steps.
Theory guide - N-Queens
Place queens using column and diagonal constraints; enumerate solutions.
Theory guide - Sum of Subsets
Explore include/exclude choices, including negative values.
Theory guide - Graph Coloring
Assign at most m colors with adjacency constraints.
Theory guide - Hamiltonian Cycle
Visit every vertex once and close the cycle.
Theory guide - Backtracking: Design Method
Choose, check, recurse and undo.
Theory guide
GreedySee local choices, exchange arguments, priority queues, and greedy-vs-DP tradeoffs.
Greedy- Greedy Suite
Scheduling, fractional knapsack, interval selection, Huffman-style choices, and greedy-vs-DP tradeoffs.
Theory guide - Activity Selection
Maximize compatible activity count by earliest finishing time.
Theory guide - Fractional Knapsack
Take profit-per-weight ratios in decreasing order.
Theory guide - Job Sequencing with Deadlines
Schedule unit-duration jobs before deadlines for maximum profit.
Theory guide - Huffman Coding
Construct an optimal binary prefix code.
Theory guide
Matrix / GridVisualize cells, neighbors, paths, flood fill, mazes, and matrix transformations.
Matrix / Grid- Matrix/Grid Renderer Suite
Cell-grid learning renderer for DP tables, maze grids, flood fill, pathfinding, and matrix transforms.
Theory guide - Matrix/Grid Suite
Flood fill, island counting, maze BFS, matrix rotation, prefix sums, and cellular automata.
Theory guide
GamesLearn game rules, legal moves, evaluation, search trees, and decision-making strategies.
Games- Tic Tac Toe Minimax
Learn the rules, threats, blocks, and simple look-ahead strategy on a 3x3 board.
Theory guide - Chess Look-Ahead
Learn legal moves, king safety, board scoring, and simple chess engine look-ahead.
Theory guide - Sudoku Backtracking
Learn Sudoku row, column, and box rules through try, check, recurse, and undo.
Theory guide - Go Liberties and Territory
Learn stones, groups, liberties, captures, and territory evaluation on a small Go board.
Theory guide - Connect Four Look-Ahead
Learn gravity, four-in-a-row threats, blocking, and window scoring.
Theory guide - Checkers Capture Search
Learn diagonal moves, forced captures, jump chains, and move search.
Theory guide - Minesweeper Constraints
Learn number clues, safe squares, mine flags, and constraint propagation.
Theory guide - 2048 Expectimax
Learn sliding tiles, merging, random tile spawns, and expectimax-style move choice.
Theory guide