10 Greedy algorithms

In this chapter

  • You learn about the greedy strategy, a very simple problem-solving strategy.
  • You learn how to cope with the impossible: problems that have no fast algorithmic solution (NP-hard problems).
  • You learn about approximation algorithms, which you can use to find an approximate solution to an NP-hard problem quickly.
  • You learn about the greedy strategy, a very simple problem-solving strategy.

The classroom scheduling problem

Suppose you have a classroom and want to hold as many classes here as possible. You get a list of classes.

You can’t hold all of these classes in there because some of them overlap.

Get Grokking Algorithms, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.