Programming Assignment #5

 

CS163: Data Structures

 

 

 

 

Problem Statement:

You would like to create a graph what you need to do to get your degree (what classes you need to take). Some classes depend on others being done first, which is why a graph is useful. For example, you need to take CS163 prior to taking CS202. But, you don’t have to take CS201 before you take CS202.

 

Required Operations:

 

Your graph should be implemented as an array of vertices where each vertex has a head pointer to a linear linked list of edges.

 

Your table (graph) ADT must support operations for adding vertices, adding connections (edges), removing vertices, removing edges, displaying the entire graph. You are NOT required to implement a depth first or breadth first traversal. You WILL want to be able to search to find out what classes you can take NEXT after a given class (e.g., so if you take CS163, what classes are in the 163 adjacency list?)

 

Implement the abstract data type using a separate header file (.h) and implementation file (.cpp). Only include header files when absolutely necessary. Never include .cpp files!

 

Syntax Requirements:

1) Use iostream.h for all I/O; do not use stdio.h

2) Implement the table ADT as a class; provide a constructor and a destructor.

3) Make sure to protect the data members so that the main() program does not have direct access.

 

What to Turn in:

• On the due date, email your programs source code and your design considerations write-up.

 

REMINDERS: Every program must have a comment at the beginning with your first and last name, the class (CS163) and section, the name of the file, and the assignment number. This is essential!