Computer Science I / Greedy Choices and Counterexamples
Practice question · Select all that apply

Select every true statement about greedy algorithms.

Hints
  1. Only one option overclaims a guarantee.
  2. Simplicity and speed are real virtues; global optimality is not automatic.
Show the answer
  • B. The coin-change problem shows greedy depends on the coin system.
  • C. Kruskal's and Prim's algorithms are greedy and provably correct.
  • D. At each step it takes whatever looks best right now and never revisits it.
  • E. Greedy always produces the optimal solution for any optimisation problem.
Why

Greedy is simple, fast, and never backtracks, and it needs a correctness proof or a counterexample. What it is NOT is automatically globally optimal, that overclaim is the trap.

Read the lesson: Greedy Choices and Counterexamples →

Practise Greedy Choices and Counterexamples

The app has 5 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Greedy Choices and Counterexamples