Massachusetts Institute of Technology
6.042J/18.062J, Spring ’10
: Mathematics for Computer Science
February 26
Prof. Albert R. Meyer
revised February 21, 2010, 1418 minutes
Solutions to InClass Problems Week 4, Fri.
Problem 1.
The table below lists some prerequisite information for some subjects in the MIT Computer Science
program (in 2006). This defines an indirect prerequisite relation,
�
, that is a strict partial order on
these subjects.
18
.
01
6
.
042
18
.
01
18
.
02
→
→
18
.
01
18
.
03
6
.
046
6
.
840
→
→
8
.
01
8
.
02
6
.
001
6
.
034
→
→
6
.
042
6
.
046
18
.
03
,
8
.
02
6
.
002
→
→
6
.
001
,
6
.
002
6
.
003
6
.
001
,
6
.
002
6
.
004
→
→
6
.
004
6
.
033
6
.
033
6
.
857
→
→
(a)
Explain why exactly six terms are required to finish all these subjects, if you can take as many
subjects as you want per term. Using a
greedy
subject selection strategy, you should take as many
subjects as possible each term. Exhibit your complete class schedule each term using a greedy
strategy.
Solution.
It helps to have a diagram of the direct prerequisite relation:
18.01
8.01
6.001
6.046
6.002
8.02
18.03
6.042
18.02
6.034
6.004
6.840
6.033
6.857
6.003
There is a
�
chain of length six:
8
.
01
�
8
.
02
�
6
.
002
�
6
.
004
�
6
.
033
�
6
.
857
Creative Commons
2010,
Prof. Albert R. Meyer
.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
�
�
2
Solutions
to
InClass
Problems
Week
4,
Fri.
So six terms are necessary, because at most one of these subjects can be taken each term.
There is no longer chain, so with the greedy strategy you will take six terms. Here are the subjects
you take in successive terms.
1:
6.001
8.01
18.01
2:
6.034
6.042
8.02
18.02
18.03
3:
6.002
6.046
4:
6.003
6.004
6.840
5:
6.033
6:
6.857
(b)
In the second term of the greedy schedule, you took five subjects including 18.03. Identify a
set of five subjects not including 18.03 such that it would be possible to take them in any one term
(using some nongreedy schedule). Can you figure out how many such sets there are?
Solution.
We’re looking for an antichain in the
�
relation that does not include 18.03. Every such
antichain will have to include 18.02, 6.003, 6.034. Then a fourth subject could be any of 6.042, 6.046,
and 6.840. The fifth subject could then be any of 6.004, 6.033, and 6.857. This gives a total of nine
antichains of five subjects.
�
(c)
Exhibit a schedule for taking all the courses —but only one per term.
Solution.
We’re asking for a topological sort of
�
. There are many. One is 18.01, 8.01, 6.001, 18.02,
6.042, 18.03, 8.02, 6.034, 6.046, 6.002, 6.840, 6.004, 6.003, 6.033, 6.857.
�
(d)
Suppose that you want to take all of the subjects, but can handle only two per term. Exactly
how many terms are required to graduate? Explain why.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '11
 Prof.AlbertR.Meyer
 Computer Science, Partially ordered set, Oscar, Liz, Inclass problems, Prof. Albert R.

Click to edit the document details