Question: For this programming assignment, you will implement a Queue whose size can grow as elements are inserted into the queue. You will build three different
For this programming assignment, you will implement a Queue whose size can grow as elements are inserted into the queue. You will build three different implementations of this Queue. Two of these implementations will be array-based. Each of these two should take an initial capacity for the queue in the constructor. The only difference between these implementations will be what happens when the Queue is full. For the first implementation, ArrayQueue, you should increase the size of the array by a constant amount. For the second implementation, DoublingArrayQueue, you should double the size of the array. Finally, for the third implementation, you should implement a Queue using a Linked List.
You will now time your three implementations. For each version of your queue, enqueue a large amount of random numbers onto the queue (e.g. 10 million). Time how long this takes using the StopWatch class we provided (eCampus). However, you should measure the total time at fixed intervals (e.g. every 10000 enqueue operations). For the array-based implementations, you should start with some small capacity significantly smaller than the maximum number of enqueue operations. For the ArrayQueue, your increment amount should also be significantly smaller than the number of enqueue operations. You will then graph the times for the three implementations. This process will allow you to see how your choice of implementation can affect performance.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
