Question: Using python 3, Implement the Bounded Queue and Circular Queue ADT as seen in class. The python implementations of these data structures are in the

Using python 3, Implement the Bounded Queue and Circular Queue ADT as seen in class. The python implementations of these data structures are in the lecture slides. Make sure you raise exceptions when peek()/dequeue() if the queue is empty. enqueue() if the queue is full . Compare the runtime of dequeue() method in Bounded Queue and Circular Queue. In bounded queue, once you dequeue an item, the remaining items in the list will be shifted left. But in circular queue, you just change the start pointer (index) when you dequeue. So in theory, dequeue in circular queue should be much faster than that in bounded queue. Write your code to justify whether this hypothesis is true or false. Here are the steps for this experiment: 1. Create two queues, one bounded queue and one circular queue. 2. Insert some items into each queue. 3. Use the code we give to count the runtime of dequeue() function in each queue. 4. Print the dequeue() runtime for each queue and the runtime difference on screen. Since the computer is very fast, you may need to use a quite large capacity value and insert enough items. When counting the dequeue() runtime, do not just count the runtime of one function call, count the total runtime of considerable (for example, 1000) function calls for each queue. Otherwise you may just see zeros of the runtime. HINT: How to measure the time interval: import time start = time.time() # The program you want to test end = time.time() time_interval = end - start

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!