Written Assignment 2 -- Due 9:30 a.m. Thursday, Sept. 21 at the beginning of class
CS 3511 Fall Semester, 2006
20 Points

Topics: Pseudocode, Proofs, Algorithms, Big-O

Reading assignment:
Sections 3.4 - 3.8 of 6th Edition ( = Sections 2.4 - 2.6 of 5th Edition )

Written assignment:

  1. (5 points) Show how to implement any "if" -- i.e.:
         if condition then
         begin
            statements
         end
    
    with a "while" -- i.e.:
         while condition 
         begin
            statements
         end
    
    You may add statements and add to the condition, using new Boolean variables and logical operators ("and", "or", and "not") where appropriate.
  2. (3 points) Exercise 35 Sect. 1.5, page 74 ( = Exercise 77 Sect. 1.5, page 77 of 5th Ed.).
  3. (4 points) Exercise 37 Sect. 3.1, page 178, ( = Exercise 37 Sect. 2.1, page 130 of 5th Ed.), which says write pseudocode for an enhanced version of bubble sort that stops when no new interchanges are required.
  4. (4 points) Exercise 52 Sect. 3.1, page 179 ( = Exercise 52 Sect. 2.1, page 131 of 5th Ed.), which says to use the greedy algorithm to make change using quarters, dimes, nickels, and pennies for:
    (a) 87 cents (b) 49 cents (c) 99 cents (d) 33 cents
  5. (4 points) Exercise 54 Sect. 3.1, page 179 ( = Exercise 54 Sect. 2.1, page 131 of 5th Ed.), which says to use the greedy algorithm to make change using quarters, dimes, and pennies (but no nickels) for the amounts of the previous problem. For which of these amounts does the greedy algorithm use the fewest coins possible?



Page URL: http://www.d.umn.edu /~ddunham/cs3511f06/assignments/a2/assignment.html
Page Author: Doug Dunham
Last Modified: Wednesday, 13-Sep-2006 10:21:40 CDT
Comments to: ddunham@d.umn.edu