Saint Mary’s University

Department of Mathematics and Computing Science

CSC 341.1: Data Structures and Software Engineering I

Fall 1998-99

Assignment #2

Instructor: Dr. Pawan Lingras

Due Date: October 7,1998

 Write a function called TimeIt that accepts an integer n and a pointer to function f(int) as parameters. The function TimeIt finds out the time required for running the function f with n as the parameter. Test the program to time functions that take linear, quadratic, cubic and exponential times for different values of n. Also test TimeIt for InsertionSort for sorting n random numbers for different values of n. Arrange the output in a tabular form.

You will need programs 2.15 and 2.32 along with the programs developed in the labs to do this assignment.