3. Given a finite sequence A of number, a subsequence of A is a sequence formed by
choosing some numbers from A with their orders in A preserved. For example, Let A be
10 9 39 24 36 45 14 60. Then a subsequence can be 9 24 60.
Describe an algorithm using pseudocode. Given array A[0..n-1] of n numbers, output
the set of ALL increasing subsequences of A.
Example: Given list 2 5 3, then the set of ALL of increasing subsequences is:
{
2
5
3
25
23
}
Note that a sequence of single element is technically an increasing subsequence.
Hint: An increasing subsequence of A[0..n-1] is either an increasing subsequence of
A[0..n-2], or some increasing subsequence of A[0..n-2] followed by A[n-1], or a
sequence of single element A[n-1]. Given a list L which is the set of all increasing
subsequences of A[0..n-2], how will you extend L to the set of all of the subsequences
of A[0..n-1]?