CPSC 221H-200: Data Structures & Algorithms
Programming Assignment #1
Spring 2009


General Guidelines for Programs


Assignment

Due: Monday February 2, 2009 by 11:59pm. Code should be turned in electronically using the mechanism described above. You should also turn in an electronic copy of your report using the same mechanism as you do for the code; the electronic copy does not need to have the signed coverpage. In addition, you should submit a hardcopy of your report (but no code). This is due at the beginning of lab on February 3, 2009; the hardcopy must include the signed coverpage.

This programming assignment concerns an array-based implementation of the stack ADT. You will add a variant of one of the existing stack operations (size) that uses a different implemention and you will compare the performance of your version, mySize(), with the already provided size(). This will allow you to see how the choice of implementation can affect performance.

Coding Portion. (50 points)

Report. (50 points) You will write a brief report that includes theoretical analysis, a description of your experiments, and discussion of your results. At a minimum, your report should include the following sections:

  1. Introduction. In this section, you should describe the objective of this assignment.
  2. Theoretical analysis. In this section, you should provide an analysis of the running time of your mySize() method assuming there are N elements in the stack when mySize() is invoked. Express your answer using asymptotic notion. Compare the theoretical efficiency of this new version of mySize() with the version of size() in the text that uses the internal variable t.
  3. Experimental Setup. In this section, you should provide a description of your experiment setup, which includes but is not limited to
  4. Experimental Results. In this section, you should compare the performance (running time) of size() and mySize() to each other and to their theoretical complexity.