CS 361: Algorithms and Data Structures
Homework 4


This homework assignment is entirely a programming assignment. It is required that you work with a partner.

In this assignment, you will be implementing a directed graph data structure in Java. Your class should be called Graph<V> (note the use of generics for the vertex type). The starter code contains GraphIfc.java which is an interface that your class must implement. Click here to see the Javadoc for the interface class.

You should use an adjacency list representation for storing the directed graph. As such, you can use a List<List<V>> or a Map<V, List<V>> for the adjacency list.

You should test your code as you write it. A good idea is to test each method inside of main()

You can download the starter code by clicking here. The starter code also contains a Word document to complete. Inside the Word document, you should state the worst-case running time for each of the methods in your Graph<V> class.


Grading

You will be graded on the following:

  • The functionality of your Graph<V> class. I will test each method to make sure it works correctly (including throwing errors when appropriate).

  • Your adherence to the course style guide

  • Your worst-cases analysis of each method. Does your analysis of the worst-case running time of each method actually match your code?

  • The efficiency of your code. That is, did you implement each method as efficiently as possible. For example, many of the methods can be implemented in constant time -- i.e. O(1).


  • Submitting Your Assignment

    Your Java code should be submitted in a zipped directory. The directory should contain the interface as well as your Graph<V> class. It should also contain your completed Word document.

    You and your partner only need to submit one directory. Please make sure that you put both of your names in the class comments so I know who you worked with. Your code should compile with no errors.

    You should submit your zipped directory to Moodle before the beginning of the class period.




    Last modified: Fri Jan 24 10:58:47 PST 2014