Data Structures & AlgorithmsVery hardICPC regional · matroid greedy

Problem: Which two properties define a matroid, which is what makes the greedy algorithm optimal?

  1. A. Commutativity and associativity
  2. B. Monotonicity and convexity
  3. C. Planarity and bipartiteness
  4. D. Hereditary property and the exchange property

Correct answer: D. Hereditary property and the exchange property

Greedy is optimal on matroids because every independent set can be extended by the exchange property.

More Coding Interview Problems questions

Exams that ask this topic