• Implement a LinkedQueue class and put your implementation into linked_queue.py. You must use a singly linked list to i

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

• Implement a LinkedQueue class and put your implementation into linked_queue.py. You must use a singly linked list to i

Post by answerhappygod »

• 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.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply