Dynamic Programming Visualizer

Current Cell
Accessed Cell
Calculated Cell
Base Case Cell
Key Element
Range
Pivot
Skipped

DP Table Visualization

Algorithm State

Current State
-
Iterations
0
Current Operation
Waiting to start...

Memory State

Variables
n:
-
i:
-
j:
-
Algorithm Specific
No algorithm selected
-
Time & Space Complexity
Time Complexity:
-
Space Complexity:
-
Current Space:
-

Algorithm Code

// Select a DP algorithm to see its code

Algorithm Step

Select a DP algorithm and click visualize to see the explanation of each step.

Step 0 of 0

DP Results

Time Efficiency
O(n)
Worst-case time complexity
Space Usage
O(1)
Auxiliary space complexity
Iterations
0
Total iterations

DP Summary

DP Algorithm Comparison

Algorithm Time Complexity Space Complexity Description
Fibonacci Sequence O(n) O(n) / O(1) (optimized) Calculates the nth Fibonacci number using DP.
Climbing Stairs O(n) O(n) / O(1) (optimized) Counts ways to reach the top of stairs.
House Robber O(n) O(n) / O(1) (optimized) Maximizes stolen value from houses.
Longest Increasing Subsequence (LIS) O(n^2) / O(n log n) O(n) Finds the longest increasing subsequence.
Maximum Subarray Sum O(n) O(1) Finds the contiguous subarray with the largest sum.
Cutting Rod O(n^2) O(n) Maximizes value by cutting a rod.
Unique Paths in a Grid O(m*n) O(m*n) Counts paths in a grid.
Minimum Cost Path in a Grid O(m*n) O(m*n) Finds the minimum cost path in a grid.
Edit Distance O(m*n) O(m*n) Calculates edit distance between two strings.
Longest Common Subsequence (LCS) O(m*n) O(m*n) Finds the longest common subsequence.
Knapsack 0/1 O(n*W) O(n*W) Solves the 0/1 knapsack problem.
Matrix Chain Multiplication O(n^3) O(n^2) Optimizes matrix chain multiplication.
Triangle Path Sum O(n^2) O(n^2) Finds the minimum path sum in a triangle.