CSC 141: Assignment 1

Due on Monday 11 Oct

Michalis Faloutsos

Important: you should keep checking the news-group for updates: ucr.cs.141.
 

I . Written part.

 Questions from the book. It should be handed in on the class of the due date.
  1. 5.4-4
  2. 5.4-5
  3. 5.5-2. Find a graph for n=7, and then try to generalize for n>7.
  4. 5.5-5
  5. 5.5-7. Tips: Compare a non-complete binary tree of height h with a complete binary tree of the same height. Then compare complete binary trees of different height.
  6. 23.1-1

II. Programming part.


We want to write a program in C++ that will represent graphs. The program should read a file with the graph data, convert it into an adjacency-list representation.

In more detail, the data file should be in the format, total number of nodes and then pairs of nodes that are connected with an edge:

30
1     2
2     3
2     1
.........
n1     n2

Note that n1   n2 means the edge in the direction from n1 to n2 and not the other way. (This way, we can define directed graphs.)
We want to implmement the following classes:

  1. class Graph;
  2. class Node;
  3. class Edge;
Down-load the definitions and complete the methods that are missing. The contructors and destructors of each class are not listed but they should be implemented. Feel free to write auxiliary methodss. Your code should be documented: every method should have a brief one or two line explanation. You should have the program in multiple files: header.h,  [class].cc, main.cc. You should compile it with the use of a makefile. Your wonderful TA, Michael, will explain this in the lab and provide some makefile samples.

What to submit

  1. 1-2 page report explaining what you did and how, what you did not do, a sample output. The grader should be able to grade the assignment by just reading the report. However, the grader will check out your program and your programming style.

  2. WARNING: A report that makes false claims about the program is a serious offense.

  3. Electronically: submit your program ready to compile and a README file for instructions on how to run it.

  4. The program is due on 11:59 pm of  the due-date

.