# CS 302 - Data Structures

## Fall 2016

## Programming Assignment 5: Event Simulation

## Due on Tuesday, November 15 at 4:00 pm

Programming Problem 6 and 7 on Page 413-414. 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.

- Single queue for one teller
- Three queue for three tellers (events take turn in the order of arrival or enter the shortest line)
- Single queue for three tellers
- [Bonus 1 points] Single queue with arbitrary number of tellers
- [Bonus 1 points] Arbitrary number of queues with a teller for each

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

Randomly generate 99,999 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 99,999 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 in a table:

- the total simulation time (in terms of CPU time)
- the total processing time (in terms of virtual time)
- the average wait time
- the maximum wait time
- the average length of the line
- the maximum length of the line
- the total idle time of each teller

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

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

- Source code for your classes (one for each data structure)
- Doxygen reports for code documentation
- A main file that tests the classes with randomly generated data
- Test output of your codes (i.e., result table with average of 10 runs)

Teaching Assistant: Iman Vakili

What to turn in:
A softcopy of your sourcecode and reports should be **uploaded to WebCampus**. Combine the files in a single zip file.