CS 1321 (Principles of Algorithm Design II):
Homework #5 Sample Solution

Sample solution code

Not available.

Testing

Here are the test programs we used:

Each test program tests a particular aspect of the code. To compile and run them, compile with either your naive or powers-of-two implementation, assumed to be in a file named dynamicArray.h, and run the executable with a command-line argument of 34 (or 18000 for t-stress.cc). Output should look like the following. Also be sure to check for memory leaks using mtrace, as described in the homework writeup.

Sample output for naive implementation:

Sample output for powers-of-2 implementation: