HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Dynamic programming algorithms with log in the run-time

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
thelogwithprogrammingtimealgorithmsdynamicrun

Problem

Most of the classic examples of dynamic programming algorithms have run-times such as $n$ or $n^2$. Are there any natural examples with a $O(n \log n)$ run-time?

Solution

One natural example is finding the longest increasing subsequence of a sequence of $n$ numbers. Candidate subsequences can be linked in the input sequence. This is a fairly common exercise, and works for other type of subsequences, too. It is actually the exercise 15.4-6 in the 3rd edition of the Cormen et al. book too. For an algorithm, see Section 2.2 in these notes.

Context

StackExchange Computer Science Q#6546, answer score: 3

Revisions (0)

No revisions yet.