| Homework 15General 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).
- 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 4.1 #5 (page 137). (5 points) Note: The line that reads "if(A[n-1,j])" should be interpreted like it was written in C/C++. In other words, it means "if(A[n-1,j]==1)". Read the algorithm very carefully and try it out on a few graphs. If the algorithm is not correct, show a sample graph for which it gets the wrong answer and explain why it is wrong.
- IDAA 4.2 #1 (page 142). Assume adjacency lists are in alphabetical order and start from vertex a.
Make sure you show all of the necessary work and don't forget to give the topological sort in each case. (10 points)
- IDAA 4.4 #2 (page 156). (5 points) (Hint: Think about the relationship between the number of bits in the binary representation of n and what you need to compute. Then consider how a decrease-and-conquer strategy might be useful. Also, there is no log function for you to call. You need to do it with just basic integer arithmetic.)
- IDAA 4.4 #4 (page 156). Make sure you clearly explain your calculation(s). Your final answer should be something like "binary search is X times faster than sequential search", NOT something like "it takes X more steps". If you don't understand the difference between these statements, please ask me for clarification. (5 points)
- Bonus in future?
IDAA 4.5 #13 (page 167). (5 points) This is not a yes-no question. It is asking you to design an algorithm. Be careful because it is easy to make false assumptions about what the data looks like.
Important Reminders:
- Give a clear description of your algorithms. You may give code/pseudocode,
but you must also include a short description of the algorithm since it is usually very difficult to determine what an algorithm is doing from code alone.
- Don't forget to give and justify the complexity of your algorithms.
- Remember to give the most efficient algorithm possible—if there is a
more efficient algorithm, you will likely lose some points.
- This book has hints in the back for many of the problems. Use them as needed.
Tip: Always make sure you test your algorithms on several reasonable inputs to convince yourself they are correct.
Note: These reminders and tips will not appear on future assignments but they will still apply.
|