This file contains the exercises, hints, and solutions for Chapter 9 of the
book ”Introduction to the Design and Analysis of Algorithms,” 3rd edition, by
Exercises 9.1
1. Write pseudocode of the greedy algorithm for the change-making problem,
with an amount and coin denominations 1
2···
as its input.
What is the time efficiency class of your algorithm?
2. Design a greedy algorithm for the assignment problem (see Section 3.4).
Does your greedy algorithm always yield an optimal solution?
4. Compatible intervals Given open intervals (1
1)(2
2) (
)on the real line, each representing start and end times of some activity
requiring the same resource, the task is to find the largest number of these
intervals so that no two of them overlap. Investigate the three greedy
5. Bridge crossing revisited Consider the generalization of the bridge cross-
ing puzzle (Problem 2 in Exercises 1.2) in which we have 1people
whosebridgecrossingtimesare1
2 All the other conditions of
the problem remain the same: at most two people at the time can cross
1