CS 231: Assignment #9

Programmer's Choice

This week you can choose what you want to simulate. The only requirement is that it either simulate a data structure (e.g. stack, queue, tree, heap) or use a data structure as an integral part of the simulation. Some suggestions are given below.

You have two weeks for this project, which will be due after Thanksgiving break. During the first week, please email Professor Maxwell with your project idea.

Documentation for Java 1.5 is located at: Java 1.5 SE API.

Documentation for Java 1.6 is located at: Java 1.6 SE API

Problem Description

You can choose this week from one of two types of simulations. First, you could visually simulate a data structure from the list below, with elements adding and removing themselves so as to demonstrate to an observer the functionality of the data structure. If you choose this option, you must write the data structure class yourself, just as you wrote the Queue data structure for the Checkout simulation.

The second choice is to develop a simulation that uses a data structure from the list below as an integral part of its operation. The Checkout simulation is one example. If you chose this option, you may use a Java library implementation of the data structure.

The following are some of the data structures you could simulate/use.


  1. Build your simulation. If you chose to simulate a data structure, create a visual representation of the structure with the nodes of the structure as agents. Then demonstrate adding, removing, or other operations on your structure. It would be great if the user could manipulate the data structure somehow, even through a simple command line menu and interface.
  2. Identify a set of computable attributes of your simulation. For example, last week you computed the number of agents, the amount of broccoli, and some average attributes of the agents. If you simulate a data structure, the calculate attributes like the average time to insert or delete an element from the structure (complexity analysis).


  1. Use more than one data structure from the list.
  2. Create a nice user interface to the visual representation of a data structure.
  3. Let the user interact with the simulation.


Make your writeup for the project a wiki page in your personal space. If you have questions about making a wiki page, stop by my office or ask in lab.

Your writeup should have a simple format.

Once you have written up your assignment, give the page the label:


You can give any page a label when you're editing it using the label field at the bottom of the page.

Do not put code on your writeup page or anywhere it can be publicly accessed. To hand in code, please put it on the Academics server in your folder within the COMP/CS231 directory.