CS 256

Spring 2006
Williams College

Algorithms

Date Assigned Assignment Date Due Solution
6 Feb Homework 1 13 Feb Posted
13 Feb R-5.4, a,c,e (after doing the reading)
R-1.13,1.14 (using sums or induction)
R-1.19 (using the definition of bigO)
R-1.27

One more question: Stacia has borrowed Bill's Tower's of Hanoi puzzle to demonstrate in class. In the middle of the demonstration, she is called away, and Bill comes in to take over. Coming upon the puzzle in a valid state on the way to being solved, how can Bill figure out what his next move should be? A precise answer is not required (but is welcome!) for this problem. Show me how you reason about a problem like this and, if you don't have an exact solution, give a heuristic one.

20 Feb Posted
22 Feb
  • R-3.2 Give 2 orderings of the same list of numbers which produce 2 different trees.
  • R-3.8
  • R-3.10
  • R-3.15 BUT for a., just insert 0,2,4,6,8, in that order
    for b., just search for 1,3,5,7 in that order
    and for c., just delete 0,2,4,6 in that order
  • R-3.16
  • C-3.3 Write an algorithm in pseudocode. Assume you have a collection c as a parameter to which you can add elements which are returned to the user. You add elements with c.addElement(v). Also answer: if you find a k and there is another, where will it be?
Extended to Friday, 3 Mar Posted
Exam 1 Solution The raw LaTeX the pdf.
3 Apr R-6.1,R-6.2,C-6.12,C-6.18,C-6.19 10 Apr Posted
11 Apr R-7.11,C-7.2,C-7.3,C-7.10 17 Apr Posted
17 Apr R-8.2,R-8.3,R-8.4 Read section 8.3 and do problem R-8.8. 24 Apr
1 May
  • R-9.2
  • R-9.3
  • R-9.8
  • Best case:Find the best case for the gift wrapping algorithm: sets of n points such that the algorithm's aymptotic time complexity is as small as possible as a function of n. What is this time complexity?
  • Worst case:Construct a set of points for each n that causes the largest number of iterations of the while loop of the scan in the GrahamScan algorithm.
8 May