COMP 2012H Honors Object-Oriented Programming and Data Structures

Lab 6 Inheritance

Common Errors

  1. Forgetting to implement circular array, and encountering time-out on ZINC.

  2. Modulo against size instead of capacity, thus incorrect indexing of the circular array.

  3. Forgetting to call delete on internal_array in the Destructor.

  4. Not strictly required: Not implementing amortized O(1) array reallocations, by only doubling the array capacity when trying to insert an element when at full capacity. Furthermore, better memory efficiency can be achieved (with still amortized O(1) array reallocations) by halving the array capacity whenever the array is only at 1/4 capacity after removing an element.

  5. Not really an error, but a sneaky trick to test your conceptual understanding: There is no need to implement a circular array for Stack, since the head index never needs to be modified.