Browse the AlgoLens catalog
Search starter algorithms, filter by category, and jump directly into a trace-driven lesson.
N-Queens
Places one queen per row while avoiding column and diagonal conflicts.
Rat in a Maze
Explores valid moves until it reaches the exit or needs to backtrack.
Sudoku Solver
Fills empty cells with digits that satisfy row, column, and box constraints.
Hamiltonian Cycle
Builds a cycle that visits every vertex exactly once and returns to the start.
Graph Coloring
Assigns colors so adjacent vertices never share the same color.
Knights Tour
Moves the knight so every square is visited exactly once.
Traveling Salesman Problem (TSP)
Searches for the cheapest Hamiltonian cycle while pruning branches whose lower bound is already too expensive.
0/1 Knapsack
Explores include/exclude decisions while pruning branches whose upper bound cannot beat the best value.
Job Assignment Problem
Assigns one unique job to each worker while pruning assignments that already cost too much.
Linear Search
Scans each element one by one until a match is found.
Selection Sort
Selects the minimum remaining element and swaps it into place.
Bubble Sort
Repeatedly compares adjacent values and bubbles larger items toward the right edge.
Naive String Matching
Tries every possible pattern alignment against the text.
Strassens Matrix Multiplication
Multiplies matrices by reducing the number of recursive subproducts.
Closest Pair of Points
Recursively splits points by x-coordinate and checks a narrow strip around the midpoint.
Fibonacci (DP)
Builds Fibonacci values bottom-up in a table.
Longest Common Subsequence (LCS)
Builds a matrix of best subsequence lengths for every prefix pair.
Longest Increasing Subsequence (LIS)
Tracks the best increasing subsequence ending at each position.
Matrix Chain Multiplication
Finds the cheapest way to parenthesize a matrix product chain.
0/1 Knapsack (DP)
Fills a value table over items and capacities.
Coin Change
Builds the minimum coins needed for every amount up to the target.
Edit Distance
Measures the minimum insertions, deletions, and substitutions to transform one string into another.
Rod Cutting
Builds the best obtainable revenue for every rod length up to the target.
Activity Selection
Chooses the next activity that finishes earliest among the compatible options.
Huffman Coding
Builds an optimal prefix code by repeatedly merging the two lightest nodes.
Kruskals Minimum Spanning Tree
Adds the lightest edge that does not create a cycle.
Prims Minimum Spanning Tree
Grows one tree by repeatedly taking the cheapest edge leaving the current tree.
Fractional Knapsack
Takes items by decreasing value density, allowing fractional picks when capacity runs out.
Factorial
Multiplies n by factorial(n - 1) until the base case is reached.
Fibonacci (recursive)
Expands into two recursive calls until the small base cases are reached.
Tower of Hanoi
Moves a stack of disks using one spare rod and the recursive three-step pattern.
Power Calculation
Raises a base to an exponent using recursive exponentiation by squaring.
Euclidean Algorithm (GCD)
Repeatedly replaces the larger problem with the remainder until it becomes zero.
Sieve of Eratosthenes
Marks multiples of each prime to eliminate composite numbers in bulk.
Kadanes Algorithm
Keeps the best subarray ending at the current position and the best overall answer.
FloydWarshall Algorithm
Computes all-pairs shortest paths by gradually allowing more intermediate vertices.
BellmanFord Algorithm
Relaxes every edge repeatedly to support negative weights.
Insertion Sort
Builds a sorted prefix by inserting each value into its proper place.
Merge Sort
Recursively splits the array, sorts halves, and merges them back together.
Quick Sort
Partitions around a pivot so smaller values move left and larger values move right.
Binary Search
Searches a sorted array by repeatedly halving the active interval.
Breadth-First Search
Explores the graph level by level using a queue.
Depth-First Search
Explores one branch deeply before backtracking.
Dijkstra
Computes shortest paths in graphs with non-negative edge weights.