Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python3 Queue For test case plz use unittest! HELP!!!! Goal: Implement a Queue class using a circular array: Class QueueArray Implement a Queue class using

Python3 Queue
For test case plz use unittest! HELP!!!!
image text in transcribed
image text in transcribed
Goal: Implement a Queue class using a circular array: Class QueueArray Implement a Queue class using a linked data structure: Class QueueLinked Before doing this lab make sure to read over section 3.10, 3.11, 3.12 carefully. You will not be doing the implementation as described in section 3.12, but it will help you understand the underlying concepts. The first implementation you will use a linked structure similar to the linked structure used in implementing the Stack ADT. In this case, there must be a way to add items to the back of the list and remove items from the front of the list. See picture. data next datanextdata next front rear The second implementation will use a circular array for storing the items in the queue. There are different ways of doing this but they share the idea presented in the picture. Namely elements are added to the rear of the queue using the next "free entry" in an array. (rear may be the index of the current last index storing an item in the queue or one beyond it. Elements are removed from the front (read in the picture) of the queue. Elements are added to the queue at the rear (write) of the queue. The indices in front and rear are incremented as elements are added and deleted from the queue. All arithmetic is modulo the size of the array structure allocated to store the queue. Care must be taken in distinguishing a full from an empty queue and this can be done in different ways. You should follow your instructor's advice on the best way to do this. (Why is this better than what the text does?) Note that in some implementations that maximum number of items the queue can hold is one less than the size of the array-like structure allocated. When a user of your Queue class specifies its capacity, you may have to take this into account so that the queue can actually store capacity items. . 0 1 2 3 45 67 8910 11 12 13 14 15 buf: 9 4 8 2 6 read 2 write bu 14] buty bul2) butt12) read 2 writes7 8 2 bu11 but10 buts 6 butle utl8l butt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

13. You always should try to make a good first impression.

Answered: 1 week ago