Data Structures & AlgorithmsVery hardICPC regional · combinatorics
Problem: What does the Erdos-Szekeres theorem state?
- A. Every graph has a Hamiltonian path
- B. Every prime has a primitive root
- C. Every tree is bipartite
- D. Any sequence of n^2 + 1 distinct numbers has an increasing or decreasing subsequence of length n + 1
Correct answer: D. Any sequence of n^2 + 1 distinct numbers has an increasing or decreasing subsequence of length n + 1
Pigeonhole on the longest increasing subsequence ending at each position gives the monotone subsequence bound.
More Coding Interview Problems questions
- Problem: What does Dilworth's theorem say about a finite partially ordered set?
- Problem: What is the time complexity of range-assign and range-sum queries with a lazy segment tree?
- Problem: What does the two-heap technique compute in a data stream?
- Problem: Which structure gives the best rational approximations to a real number in a tree form?
- Problem: Which algorithm computes the longest path in a weighted directed acyclic graph in O(V + E)?
- Problem: What is the minimum number of colours that suffices for any planar graph?