CSE373 Data Structures Wi06, Homework 5

Programming problems due online Thursday, 3/2/06, at 11 pm.
Written problems due at the beginning of class, Friday, 3/3/06, 2:30 pm.
No late assignments will be accepted.

This assignment devleops a graph implementation so that we can perform more complicated graph algorithms in the following week.

The assignment has several files provided:

What to do - Coding Problems

Fill in the remaining code for AdjListGraph.java, AdjMatrixGraph.java, and Edge.java. Your code should be efficient and must have the minimal big-Oh possible for the given implementation.

As usual, your code should not only work properly, but it also should be high-quality. In particular:

What to do - Written Problems

Answer these questions on a separate sheet of paper. We suggest you do these problems early as part of your preparation for the programming part of the assignment.

  1. For each of the methods in the interface, say what their Big-Ohs are for each implementation (adjacency matrix and adjacency list). Explain why. Use terms such as the number of vertices, the number of edges, and the degree of a vertex.
  2. Online social communities such as Facebook, Friendster, and MySpace have a graph-like structure. Using the vocabulary we learned in class, explain how the following statements could be posed as graph problems. Define what edges and vertices are.
  3. Write pseudocode for an algorithm to see if an undirected graph is bipartite (that is, if it is possible to color the graph in such a way that no two adjacent vertices share the same color).