Algoma University College

Computer Science 2006

Data Structures I

Fall 1996/97

Assignment #1

Pawan Lingras

Date Due: Week 3

Write a template <class type> of a class called timer which has a member function called time_t time(int n, type t) that returns the time it took to perform a procedure called t.work(int n). Make sure that the object compiles properly by linking with an empty main function and a test class which has an empty member function called void work(int n). You will have to include the file time.h.

Assignment #2

Pawan Lingras

Date Due: Week 4

Create three different descendants of timer and time three procedures consisting of the following code. Your program should tabulate results for different values of n.
for(int i = 0; i < n; i++) for(int i = 0; i < n; i++)for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++) for(int j = 0; j < i;j++)
sleep(1); sleep(1); sleep(1);

Algoma University College

Computer Science 2006

Data Structures I

Fall 1996/7

Assignment #3

Pawan Lingras

Date Due: Week 5

Horner's rule is a means for evaluating a polynomial:

as:

.