Skip to content

Glossary: Algorithms Beyond the Basics in JavaScript

Swap argument

A way to show a greedy choice is safe: take any best answer, swap its first choice for the greedy one, and show the result is no worse. For the cupping room, swapping in the booking that ends first never causes a clash.

Where the book teaches it

Related terms

Greedy algorithmInterval scheduling