CMPSCI 311: Theory of Algorithms
David Mix Barrington
Fall, 2003
Homework Assignment #1
Due Friday 12 Sept 2003 in class
(or earlier to hand-in box in CMPSCI main office)
All thirteen questions are from [L] and have the point values
indicated.
- Question 1.1.5, page 8 (10):
- Question 1.1.8, page 9 (10): For (b), your job is
to indicate, for any given two positive numbers a and b, whether
you would choose to move first or second in the game where a and
b are the starting numbers. (Hint: The number of moves in the game
turns out not to depend on the player's choices but only on a and b.
It might be easiest to determine this number and then answer based on
whether it is odd or even.)
- Question 1.1.10, page 9 (10):
You are not required to actually run your code on a computer, though
of course this is a good way to check that it is correct. You
are asked for two methods. The first takes ints m and n as input and returns
an array [d, x, y]
such that d is the GCD and mx + ny = d (or throws an exception if the
input pair is not valid). The second takes ints a,
b, and c as input and either returns an array [x, y] such that
ax + by = c or throws a NoSolutionException. (This is Java terminology,
equivalent formulations in another language are fine.)
- Question 1.2.2, page 17 (10): Indicate briefly how you went
about finding your solution, along with presenting it.
- Question 1.3.1, page 23 (5):
- Question 1.3.6, page 25 (5): Note that you are not asked
to provide the algorithm in question, just to answer questions about the
specification of the problem.
- Question 1.4.4, page 38 (5):
- Question 1.4.9, page 38 (5):
- Question 2.1.2, page 51 (10):
- Question 2.1.5, page 51 (10):
- Question 2.1.6, page 51 (10):
- Question 2.1.8, page 52 (5):
- Question 2.1.9, page 52 (5):
Last modified 4 September 2003