Massachusetts Institute of Technology
Handout 12
6.046J/18.410J: Introduction to Algorithms
March 20, 2003
Professors Piotr Indyk and Bruce Tidor
Problem Set 4
This problem set is due
at the beginning of
class on
Thursday, April 3, 2003
.
Each problem is to be done on a separate sheet (or sheets) of paper. Mark the top of
each sheet with your name, 6.046J/18.410J, the problem number, your recitation section,
the date, and the names of any students with whom you collaborated.
Problem 41.
Subsequences
Consider a sequence of numbers stored in an array
A
[1
..n
]. A
subsequence
of this array is
just a subset of the elements of the array
A
[
i
1
]
, A
[
i
2
]
, . . . , A
[
i
k
] where
i
1
< i
2
< . . . < i
k
.
Note that a subsequence does not have to be a contiguous block of elements.
(a)
A subsequence is called an
increasing subsequence
if
A
[
i
1
]
< A
[
i
2
]
< . . . < A
[
i
k
].
Devise an algorithm for computing the longest increasing subsequence of an array
— that is, an increasing subsequence consisting of the greatest possible number of
array elements. The algorithm should run in
O
(
n
2
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '03
 PiotrIndyk
 Algorithms, Dynamic Programming, Minimum Spanning Trees, unique minimum spanning, Professor Indyk, coin denominations

Click to edit the document details