Algorithms and Data Structures

G52ADS Coursework for Autumn 2008

Informal Coursework 1

General Intro

The Assignment

The goal is to develop an array-based implementation of the interface SimpleStack, provided to you complete with some unit tests.

  1. Download the source code for the interface and unit tests in simplestack.zip, unpack them, and open in your favourite IDE.
  2. Start by looking at interface SimpleStack either in the source code or in the corresponding in JavaDoc.
  3. Learn to use jUnit 4.5, if you have never used it before. (There could have been a lecture or two on JUnit by Dave Elliman in G51PRG.) Run jUnit tests SimpleStackImplTest from SimpleTests suite. Note down the run times of the *_Performance tests.
  4. Open SimpleStackImpl and replace the present implementation using java.Util.Stack with your own one. (Look for the "TODO" comments.)
  5. Run jUnit tests SimpleStackImplTest from SimpleTests suite again, now using your own implementation. Make sure they do not fail.
  6. Check the run time of *_Performance tests and compare it with the the times you noted down previously. If your implementation is too slow, rewrite the code to make it faster. (Does this relate in any way to "the big O thing"?)

Submission

Feel free not to submit this. Please do work in pairs or groups. It's so much more fun!

See more of Jakub's homepage or the list of exercises, if you please.