| Homework 18General Comments
- Most problems are found in one of the following:
- IDAA: Introduction to the Design and Analysis of Algorithms
- 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).
- You must indicate any assistance/collaboration you had on an assignment as
specified on the Policies page.
- 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
- IDAA 7.2 #2 (page 267) (6 points) Show all of your work!
- IDAA 8.1 #2 (page 290) (5 points) Use the algorithm given in the book and show your work.
- IDAA 8.2 #1 (page 296) (6 points) As with the rest, show all of your work!
- IDAA 8.2 #6 (page 297) (5 points) Do I need to remind you to show your work?
- IDAA 8.4 #7 (page 312) (5 points) Show all of the intermediate matrices.
- This problem: You can compute C(n,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.
-
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)
- A straightforward recursive algorithm based on the formula.
- A recursive algorithm that uses a memory function (or what I call memoization).
- 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)).
- Which of the options above is the best and why? (2 points)
- 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)
|
|
|