UtilityToolsLab

© 2026 UtilityToolsLab. Built and maintained by the UtilityToolsLab Team.

Free eBooks·About·Changelog·Privacy Policy·Terms of Service·Report a bug
HomeCompetitive ProgrammingDP Table Builder

Related Tools

Code FormatterMatrix GeneratorComplexity CalcBit VisualizerBitmask PlannerPrime FactorsMEX CalcInterval MergerMatrix RotationPBDS GeneratorSegment TreeGraph VisualizerStress TesterModulo CalcConvex HullPath FinderOffline JudgeBig-O AnalyzerCombinatoricsExtended GCDSieve VisualizerBinary SearchSorting VisualizerSparse Table RMQUnion-Find DSU

DP Table Builder & Visualizer

Animate DP table fills for Fibonacci, LCS, 0-1 Knapsack, Coin Change and Edit Distance. Heat-map coloring, TSV copy, and custom blank tables.

You Might Also Like

All Competitive Programming

Code Formatter

Format and beautify C++, Java, and Python code with consistent indentation. 100% client-side — no code leaves your browser.

Matrix Generator

Generate grid/matrix inputs for competitive programming. Random, zeros, identity, or sequential fill. Outputs in multiple formats.

Complexity Calc

Estimate Big-O operations and runtime for any N. Interactive reference table for all complexity classes from O(1) to O(N!).

Bit Visualizer

Toggle 32/64-bit grids. Click bits to flip them live and see decimal recalculate. Shows popcountll, clzll, ctzll, and MSB instantly.

Most DP tutorials show a completed grid with arrows drawn on a whiteboard. Watching it build cell by cell is a different experience: you see exactly which previous cells each entry reads, and the recurrence relation stops being an equation on paper and becomes a visible row-by-row sweep. DP Table Builder fills five canonical algorithms (Fibonacci, Coin Change, LCS, 0-1 Knapsack and Edit Distance) one cell at a time, 80 ms per step.

Heat-map shading makes the structure legible at a glance. Cells containing zero stay white; cells near the maximum value deepen toward terracotta orange. In the Edit Distance table between "HORSE" and "ROS", the gradient traces the diagonal path a backtracker would follow to the answer.

Every computed value is correct against the standard recurrence, not a lookup or hard-coded demo. The copy button exports the full table as tab-separated values that paste directly into Excel or Google Sheets for further analysis.

How to Use the DP Table Builder

  1. Pick an algorithm from the dropdown. The table dimensions, axis labels and parameter summary update immediately.
  2. Press Animate Fill. The orange ring highlights the active cell and each entry appears at 80 ms intervals, slow enough to follow but fast enough not to be tedious.
  3. Press Show All to skip the animation and display the complete table instantly. Useful when you want to study the finished grid without waiting for the animation.
  4. Press Reset to clear the grid back to empty for another pass. The preset stays; only the cell values clear.
  5. Press Copy TSV to copy the full computed table as tab-separated values. Paste into a spreadsheet to add annotations or highlight the optimal path.
  6. Expand Custom dimensions to create a blank grid up to 12 rows x 16 columns for hand-tracing your own recurrence.

The Five Built-In Algorithms

  • Fibonacci: 1D table, F[c] = F[c-1] + F[c-2], base cases F[0]=0, F[1]=1, computed for n=0..10.
  • Coin Change: 1D table, minimum coins for amounts 0..10 using denominations {1,3,4}. Returns -1 (shown as ∞) when an amount cannot be reached. The set {1,3,4} is the standard example where greedy fails at amount 6.
  • LCS: 2D table, Longest Common Subsequence of "ABCBDAB" and "BDCAB". The answer is in cell [5][7]. Row and column headers spell out both strings so diagonal match events are visible in the grid.
  • 0-1 Knapsack: 2D table, weights [2,3,4], values [3,4,5], capacity 0..5. The entry in the last row and last column is the maximum achievable value of 7 (items 1 and 2).
  • Edit Distance: 2D table, Levenshtein distance between "HORSE" and "ROS". The answer of 3 sits in cell [3][5]. The first row and column are base cases: transforming any prefix to or from the empty string costs exactly its length.

Accuracy and What the Table Skips

Every cell value is computed from the recurrence with no lookup tables and no hard-coded answers. The tool does not render the backtracking path, optimal solution decomposition, or memoisation traces; it shows only the completed value table, which is the artefact most DP explanations draw first. Custom blank tables accept up to 12 rows and 16 columns; above those limits the grid overflows the viewport on most phone screens.

Fibonacci — F(n) = F(n-1) + F(n-2), F(0)=0, F(1)=1

n = 0..10

0
1
2
3
4
5
6
7
8
9
10
Custom dimensions (blank table for manual entry)