What is a Longest Increasing Subsequence Visualizer?
A longest increasing subsequence visualizer shows the longest ordered subset of values where every next value is larger than the previous value. The values do not need to be adjacent in the original array.
This tool uses the O(n^2) dynamic programming approach so you can see every prior-index comparison, each length update, and the final backtracked subsequence.
For the full algorithm set, browse the Data Structure Visualizers hub.
How to use this LIS visualizer
- Enter an array of numbers.
- Click Run LIS to compute the longest increasing subsequence.
- Step forward to compare the current value against earlier values.
- Inspect the best length ending at each index.
- Read the final sequence in the output panel.
LIS and dynamic programming
For each index i, the DP value stores the best increasing subsequence that ends at i. If a previous value is smaller, it can extend that previous subsequence by one.
For related dynamic programming tools, try the Fibonacci DP Visualizer, Coin Change DP Visualizer, Longest Common Subsequence Visualizer, and Knapsack DP Visualizer.