Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Solutions Manual for Algorithm Design | Jon Kleinberg & Éva Tardos

Rating
-
Sold
-
Pages
203
Grade
A+
Uploaded on
28-09-2025
Written in
2025/2026

This Solutions Manual for Algorithm Design by Jon Kleinberg and Éva Tardos provides comprehensive, step-by-step solutions to the exercises and problems from the widely used textbook. Covering topics such as graph algorithms, greedy methods, divide and conquer, dynamic programming, network flows, NP-completeness, approximation algorithms, and randomized algorithms, this manual is a valuable companion for computer science students. Perfect for exam preparation, assignments, and self-study, it helps learners develop strong problem-solving skills and a deeper understanding of algorithmic principles. An essential resource for undergraduate and graduate students in computer science, data science, and software engineering.

Show more Read less
Institution
Course

Content preview

SOLUTIONS MANUAL
All Chapters included




1






, Algorithm Design Solutions Manual By Jon Kleinberg
Eva Tardo
1 Stable Matching
∗ ( ) tend to be more difficult, or to rely on
Note: Exercises denoted with an asterisk
some of the more advanced material.

1. Gale and Shapley published their paper on the stable marriage problem in 1962;
but a version of their algorithm had already been in use for ten years by the
National Resident Matching Program, for the problem of assigning medical
residents to hospitals.
Basically, the situation was the following. There were m hospitals, each with a
certain number of available positions for hiring residents. There were n medical
students graduating in a given year, each interested in joining one of the hospitals.
Each hospital had a ranking of the students in order of preference, and each
student had a ranking of the hospitals in order of preference. We will assume that
there were more students graduating than there were slots available in the m
hospitals.
The interest, naturally, was in finding a way of assigning each student to at most
one hospital, in such a way that all available positions in all hospitals were
filled. (Since we are assuming a surplus of students, there would be some students
who do not get assigned to any hospital.)
We say that an assignment of students to hospitals is stable if neither of the
following situations arises.
• First type of instability: There are students s and
r
s , and a hospital h, so that
– s is assigned to h, and
– sr is assigned to no hospital, and
– h prefers sr to s.
• Second type of instability: There are students s and s , and hospitals h and h ,
r r


so that
– s is assigned to h, and
– sr is assigned to hr, and
– h prefers sr to s, and
– sr prefers h to hr.
So we basically have the stable marriage problem from class, except that (i)
hospitals generally want more than one resident, and (ii) there is a surplus of
medical students.
Show that there is always a stable assignment of students to hospitals, and give an
efficient algorithm to find one. The input size is Θ(mn); ideally, you would like
to find an algorithm with this running time.

2

, Solution. The algorithm is very similar to the one from class. At any point
in time, a student is either “committed” to a hospital or “free.” A hospital
either has available positions, or it is “full.” The algorithm is the following:
While some hospital hi has available positions hi offers a position to
the next student sj on its preference list if sj is free then sj accepts the
offer else (sj is already committed to a hospital hk) if sj prefers hk to
hi then sj remains committed to hk else sj becomes committed to hi
the number of available positions at hk increases by one. the number
of available positions at hi decreases by one.
The algorithm terminates in O(mn) steps because each hospital offers a
positions to a student at most once, and in each iteration, some hospital offers a
position to some student.
Suppose there are pi > 0 positions available at hospital hi. The algorithm
terminates with an assignment in which all available positions are filled,
because any hospital that did not fill all its positions must have offered one to
every student; but then, all these students would be committed to some hospital,
Σ
which contradicts our assumption that
m
i= pi < n.
1
Finally, we want to argue that the assignment is stable. For the first kind of
instability, suppose there are students s and sr, and a hospital h as above. If h
prefers sr to s, then h would have offered a position to sr before it offered one to
s; from then on, sr would have a position at some hospital, and hence would
not be free at the end — a contradiction.
For the second kind of instability, suppose that (hi, sj) is a pair that causes
instability. Then hi must have offered a position to sj, for otherwise it has pi
residents all of whom it prefers to sj. Moreover, sj must have rejected hi in
favor of some hk which he/she preferred; and sj must therefore be committed to
some hl (possibly different from hk) which he/she also prefers to hi.
2. We can think about a different generalization of the stable matching problem, in
which certain man-woman pairs are explicitly forbidden. In the case of employers
and ap- plicants, picture that certain applicants simply lack the necessary
qualifications or degree; and so they cannot be employed at certain companies,
however desirable they may seem. Concretely, we have a set M of n men, a set
W of n women, and a set F ⊆ M × W of pairs who are simply not allowed to
get married. Each man m ranks all the women w for which (m, w) /∈ F , and
each woman wr ranks all the men mr for which (mr, wr) /∈ F .
In this more general setting, we say that a matching S is stable if it does not
exhibit any of the following types of instability.
(i) There are two pairs (m, w) and (mr, wr) in S with the property that m prefers wr
to w, and wr prefers m to mr. (The usual kind of instability.)
∈ S, and a man mr, so that mr is not part of any pair
(ii) There is a pair (m, w)
in the matching,/∈(mr, w) F , and w prefers mr to m. (A single man is
3

, more desirable and not forbidden.)




4

Written for

Course

Document information

Uploaded on
September 28, 2025
Number of pages
203
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$19.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
MaxThompson Chamberlain College of Nursing
Follow You need to be logged in order to follow users or courses
Sold
10
Member since
1 year
Number of followers
1
Documents
496
Last sold
1 month ago
EduMarket - Premium resources for learners who aim high.

I believe that education is the cornerstone of empowerment. My mission is to simplify challenging topics, spark intellectual curiosity, and provide practical tools to help you achieve your academic and professional goals. Whether you’re striving to deepen your understanding of core concepts, preparing for exams, or simply exploring new areas of interest, my site has been designed with your success in mind.

4.0

6 reviews

5
3
4
0
3
3
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions