Questions: Longest Increasing Subsequence (LIS) Problem

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

While running the O(n log n) LIS algorithm on [3, 1, 4, 1, 5, 9, 2, 6], after processing all elements the tails array is [1, 2, 5, 6]. Which statement is correct?

AThe longest increasing subsequence is 1, 2, 5, 6 taken directly from the input
BThe length of the LIS is 4, but the actual subsequence must be reconstructed separately
CThe tails array length is wrong — the LIS length should be 5 since 9 appeared
DThe algorithm failed because replacing 4 with 2 corrupted the subsequence
Question 2 Multiple Choice

In the O(n log n) LIS algorithm, why must the tails array always remain sorted?

ASo that duplicate elements can be detected and skipped
BBecause the DP recurrence requires tails in ascending order to compute dp[i]
CSo that binary search can locate the correct insertion position in O(log n)
DSo that the actual LIS can be read off directly from left to right
Question 3 True / False

The tails array in the O(n log n) LIS algorithm directly stores the actual longest increasing subsequence found in the input.

TTrue
FFalse
Question 4 True / False

For any input sequence of length n, the O(n log n) LIS algorithm performs exactly n binary searches on the tails array.

TTrue
FFalse
Question 5 Short Answer

Why does the O(n log n) LIS algorithm replace an existing tail entry rather than simply skipping elements that don't extend the current longest subsequence? What invariant does replacement maintain?

Think about your answer, then reveal below.