• Implement a LinkedQueue class and put your implementation into linked_queue.py. You must use a singly linked list to i
Posted: Sat Feb 19, 2022 3:20 pm
• Implement a LinkedQueue class and put your implementation
into linked_queue.py. You must use a singly linked list to
implement the class. Each method must run at a constant time O(1),
and the
LinkedQueue class must implement the __init__, enqueue, dequeue,
front, is_empty, __repr__, and __len__ methods. If dequeue and
front are called when a queue is empty, the methods should raise an
Empty exception.
The __repr__ method should return the contents of a queue as a
string, e.g., "[2, 7, 1]" or "[]" if the queue is empty.
• Write unit test cases to test your LinkedQueue class and save
them in test_queue.py. Test each method carefully, including
testing for the Empty exception.
into linked_queue.py. You must use a singly linked list to
implement the class. Each method must run at a constant time O(1),
and the
LinkedQueue class must implement the __init__, enqueue, dequeue,
front, is_empty, __repr__, and __len__ methods. If dequeue and
front are called when a queue is empty, the methods should raise an
Empty exception.
The __repr__ method should return the contents of a queue as a
string, e.g., "[2, 7, 1]" or "[]" if the queue is empty.
• Write unit test cases to test your LinkedQueue class and save
them in test_queue.py. Test each method carefully, including
testing for the Empty exception.