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 14

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 3.1 #4 (page 102) (10 points) (Hint: Read part b before you do part a)
  2. IDAA 3.1 #7 (page 103) (5 points) (Hint: In this problem there is a scale that gives the weight of a single pile of coins. It does not compare two piles. For part a, read the problem carefully--it is asking for a brute force algorithm. Second, the complexity of your algorithm is the number of weighings you need to do. Finally, let me clarify part (b). It is really asking you to come up with the most efficient algorithm possible to solve the problem. When it says "minimum number of weighings", it is not implying that you might get lucky and get it with a small number of weighings. It is saying what is the minimum number so that no matter what you determine the proper pile. Getting this part correct requires a very careful reading of the problem!)
  3. IDAA 3.2 #3 (page 106) (5 points) (Hint: It can be done in O(√n) time)
  4. IDAA 3.4 #7 (page 121) (5 points) As always, don't forget to analyze your algorithm.
  5. Choose either IDAA 3.5 #6 or #8 (page 129) (5 points) You don't have to give the full algorithm as long as you clearly say how to modify BFS/DFS to do the required task. For instance, you can say "whenever BFS does such-and-such, have it also do this-and-that." But make sure your description is clear and unambiguous.
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.