CS 302 - Data Structures

Spring 2015

Programming Assignment 5: Event Simulation

Due on Tuesday, Mar 31 at 9:00 am

Programming Problem 6 and 7 on Page 393-394. Remember that Section 13.4 provides details of how to implement simulations.

Note that, problem 7 has three variations of queues that are small modifications to the previous one.

  1. Single queue for one teller
  2. Three queue for three tellers
  3. Single queue for three tellers [bonus: 3 points]

Implement both the array and linked list version of the data structures.

Randomly generate 100,000 events with a random start time from the same range (i.e., from 0 to 100,000) and a duration in the range of 1 to 100 to be used as the input to the simulation. Note that the input file should be the same when different queue methods are compared.

You should first generate 100,000 random values for event start time (from a range of 0 to 100,000) and then sort them. Then, for each you can independently determine how long the event is for (random value from range of 1 to 100). These values should be written into a file that will be later read by simulator.

The following output should be provided for an average of 10 simulations for each of the simulation as an excel sheet:

  1. the total simulation time (in terms of CPU time)
  2. the total processing time (in terms of virtual time)
  3. the average wait time
  4. the maximum wait time
  5. the average length of the line
  6. the maximum length of the line
  7. the total idle time of each teller

Note: You can only use (i.e., copy) code from the book and slides. You can also use the standard libraries. You need to develop the rest of the code yourself.

Deliverables: (as source code or a doc or pdf file)

  1. Source code for your classes (one for each data structure for a total of 2)
  2. Doxygen reports for code documentation
  3. A main file that tests the classes with randomly generated data.
  4. Test output of your codes (i.e., timing snapshots and summary result table)

Teaching Assistant: M.A. Canbaz

What to turn in: A softcopy of your sourcecode and reports should be uploaded to WebCT. Do not compress as a zip file or combine as a tar file.