Longest Increasing Subsequence
Explore the different techniques used to solve the longest increasing subsequence problem efficiently.
We'll cover the following...
Longest increasing subsequence problem
Another problem we considered in the previous chapter was computing the length of the longest increasing subsequence of a given array of numbers. We developed two different recursive backtracking algorithms for this problem. Both algorithms run in time in the worst case; both algorithms can be sped up significantly via dynamic programming.
First recurrence: Is this next?
Our first backtracking algorithm evaluated the function , which we defined as the length of the longest increasing subsequence of in which every element is larger than . We derived the following recurrence for this function:
To solve the original problem, we can add a sentinel value to the array and compute ...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy