Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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. 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started