Visualize & Master
Algorithms & Data Structures
Explore classic & modern sorting algorithms, efficient searching techniques, and interactive data structure visualizations — all with real-time step-by-step animation, comparisons, swaps, and Big-O metrics.
0/1 Knapsack
Select an algorithm and press Play to watch the table fill in.
Dynamic Programming Algorithm Catalog
5 algorithms in this category. Click any card for detailed analysis.
Coin Change
UnstableCoin Change (minimum coins) finds the fewest coins that sum to a target amount using an unlimited supply of given denominations. dp[i][a] is the minimum coins using the first i denominations to make amount a.
0/1 Knapsack
UnstableThe 0/1 Knapsack problem asks: given items with weight and value, and a capacity, choose a subset that maximizes total value without exceeding the capacity. Each item is taken whole (0 or 1 times).
Longest Common Subsequence
UnstableThe Longest Common Subsequence problem finds the longest sequence of characters that appears in the same order in two strings (but not necessarily contiguously). Used in diff tools, bioinformatics, and version control.
Longest Increasing Subsequence
UnstableThe Longest Increasing Subsequence problem finds the longest subsequence of an array whose values are strictly increasing. The classic O(n²) DP tracks the length of the best increasing subsequence ending at each index.
Edit Distance (Levenshtein)
UnstableEdit Distance (Levenshtein) measures how dissimilar two strings are by counting the minimum number of single-character edits — insertions, deletions, and substitutions — needed to turn one string into the other. dp[i][j] is the distance between the first i characters of a and the first j of b.
Complexity & Performance Tradeoffs
Side-by-side comparison of Big-O time and space complexity characteristics across dp algorithms.
| Algorithm | Best Time | Average Time | Worst Time | Space Complexity | Stability |
|---|---|---|---|---|---|
| 0/1 Knapsack | O(nW) | O(nW) | O(nW) | O(nW) | Unstable |
| Longest Common Subsequence | O(mn) | O(mn) | O(mn) | O(mn) | Unstable |
| Longest Increasing Subsequence | O(n²) | O(n²) | O(n²) | O(n) | Unstable |
| Coin Change | O(nA) | O(nA) | O(nA) | O(nA) | Unstable |
| Edit Distance (Levenshtein) | O(mn) | O(mn) | O(mn) | O(mn) | Unstable |