CSCI 255 Fall 2016
Introduction to Algorithms and Discrete Structures
Archived Class
Charles Cusack
Computer Science
Hope College
Main
Schedule
Grading
Gradebook
Homework

Policies
College
    Policies
Advice

Notes
Programs
Tutorials

CSCI 125
CSCI 255
MATH 341
Others

Admin

Homework 18

General Comments

  • Most problems are found in one of the following:
    1. IDAA: Introduction to the Design and Analysis of Algorithms
    2. AIDMA: An Active Introduction to Discrete Mathematics and Algorithms
  • For full credit, provide context for each problem, show all calculations, and justify all answers by providing enough comments to explain your reasoning.
  • You will lose a significant amount of credit if you do not provide context, calculations, and justifications for a problem.
  • Numbers and/or algebra by themselves are not enough. A correct answer with no justification will be worth no more than half credit, and sometimes much less than that.
  • Precision is very important. You cannot skip steps, make guesses, or use flawed logic. Any of these things can lead to incorrect answers.
  • Homework assignments must be very neatly written or typeset (e.g. using Word or OpenOffice).
  • Remember that you can get up to 50% credit on a problem if you get significant outside assistance. Thus, if you are totally stuck on a problem it might be worth getting help. However, you must indicate any assistance/collaboration (See the Homework Assistance section on the Policies page). Failure to do so could result in a failing grade for the course! Note that getting help from the Help Center or me does not count as significant outside assistance, but talking with your classmates or searching on the Internet does!
  • If a problem asks for an algorithm, you should give the most efficient algorithm you can find to ensure full credit. You should also specify the complexity of the algorithm with justification, whether or not the problem asks for it.

Details

  1. IDAA 7.2 #2 (page 267) (6 points) Show all of your work!
  2. IDAA 8.1 #2 (page 290) (5 points) Use the algorithm given in the book and show your work.
  3. IDAA 8.2 #1 (page 296) (6 points) As with the rest, show all of your work!
  4. IDAA 8.2 #6 (page 297) (5 points) Do I need to remind you to show your work?
  5. IDAA 8.4 #7 (page 312) (5 points) Show all of the intermediate matrices.
  6. This problem: You can compute C(n,k) (n choose k) using the recursive formula C(n,k)=C(n-1,k-1)+C(n-1,k) with base cases C(n,0)=1 and C(n,n)=1 for all values of n.
    1. For each of the following, specify how much time and space is required (in the worst case) to compute C(n,k) using this formula with the following types of algorithms. (6 points)
      1. A straightforward recursive algorithm based on the formula.
      2. A recursive algorithm that uses a memory function (or what I call memoization).
      3. A bottom-up approach (i.e. Compute C(1,k) for all valid values of k, then do the same for C(2,k), C(3,k), until you get to C(n,k)).
    2. Which of the options above is the best and why? (2 points)
    3. Is there a better algorithm than the one based on the formula given above? If so, give it and explain why it is better. (In other words, give the best algorithm you can think of to compute C(n,k)). Be specific and complete with your reasoning. (2 points)