Data Structures & AlgorithmsHardICPC regional · algorithm theory
Problem: Which of the following decision problems is NP-complete?
- A. Single-source shortest paths
- B. Vertex cover (does a cover of size at most k exist?)
- C. Minimum spanning tree weight
- D. Maximum flow value
Correct answer: B. Vertex cover (does a cover of size at most k exist?)
Vertex cover is one of Karp's NP-complete problems; the other three have polynomial algorithms.
More Coding Interview Problems questions
- Problem: Which statement about the subset-sum problem with target S and n items is correct in the standard sense?
- Problem: Binary lifting on a rooted tree with n nodes uses O(n log n) preprocessing. What is the time for one LCA query?
- Problem: Which statement about building a binary heap from n given elements is correct?
- Problem: Which requirement must be met before the convex hull trick can answer queries in O(1) amortised time per query with a deque?
- Problem: Johnson's algorithm reweights edges with potentials before running Dijkstra. What does the reweighting achieve?
- Problem: Range-add updates and point queries on an array can be done with a Fenwick tree over which representation?