| Homework 18General Comments
- Most problems are found in one of the following:
- AIDMA: An Active Introduction to Discrete Mathematics and Algorithms
- IDAA: Introduction to the Design and Analysis of 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
IDAA 7.2 #2 (page 267) (6 points)
Show all of your work!
Be careful because it is easy to make a mistake on this one.
- This problem (based on 8.1): (5 points)
Solve this instance of the coin row problem: 6, 2, 3, 9, 11, 8, 5
- 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?
Also, do not forget to clearly mark the entries that were
retrieved without recomputation. (The entries that were never
computed will be blank so no need to indicate them other than leaving
them blank.)
- IDAA 8.4 #7 (page 312) (5 points)
Show all of the intermediate matrices.
- BONUS! This problem: (10 points: 6, 2, 2)
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.
-
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.
- 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?
- 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.
Hint: It might help to think of Pascal's Triangle.
|
|
|