The problem is as follows: Given a sequence L of n integers not necessarily distinct , write an algorithm that computes the increasing subsequence of maximum length :
The recurrence equation that I developed is this:
I start the index from 0:
If j = n opt(j) = 0 (base case)
otherwise opt(j) = max j <i <= n such that Lj <Li = {opt(i) +1}
do you think is right to do so? the standard solution used for this typical problem is to first calculate the maximum increasing subsequence ending in Li for all elements of the sequence and then the maximum on these values, that is:
if i = 1 opt (i) = 1
otherwise opt (i) = max 1 <= j <= i-1 and Lj <Li = {opt (i)} +1
and then the max on these elements.
so I wanted to know if you think my solution was right anyway.