Question: Queue class (15 marks) Implement the Queue class in the file queue.py. Your queue must be an array-based dynamic circular queue. You must use

Queue class (15 marks) Implement the Queue class in the file queue.py.

Queue class (15 marks) Implement the Queue class in the file queue.py. Your queue must be an array-based dynamic circular queue. You must use numpy arrays with object type elements for the underlying data structure. Except for repr which must run in O(n) time, each other method must run in constant time 0(1), and the Queue class must implement the __init__enqueue, dequeue, peek, is empty, repr_and_len__ methods. If dequeue and peek are called when a queue is empty, the methods should raise an Empty exception.

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 Mechanical Engineering Questions!