Question: in this assignment, you will implement a basic Queue using an array ( or list ) in your preferred programming language. You will also perform
in this assignment, you will implement a basic Queue using an array or list in your preferred
programming language. You will also perform a set of operations on the Queue to demonstrate
your understanding of the concept.
Instructions:
Queue Implementation points:
Implement a Queue class that supports the following operations:
enqueueelement : Adds an element to the end of the Queue.
dequeue : Removes and returns the element from the front of the Queue. If the Queue is
empty, return an appropriate message.
peek : Returns the element at the front of the Queue without removing it
isempty : Returns True if the Queue is empty, False otherwise.
size : Returns the number of elements in the Queue.
Test Cases points:
Write a main function that performs the following:
Enqueue the elements and into the Queue.
Display the element at the front using the peek method.
Dequeue two elements and display the elements dequeued.
Check if the Queue is empty.
Display the size of the Queue.
Continue dequeuing all elements until the Queue is empty.
Attempt to dequeue from an empty Queue and display the resulting message.
Code Structure and Comments points:
Ensure that your code is wellstructured and contains comments explaining key parts of your
implementation.
Extra Credit Optional points:
Modify your Queue implementation to allow a circular queue with a fixed size. Provide
additional operations:
isfull : Returns True if the Queue is full, False otherwise.
Adjust enqueue and dequeue to support the circular queue behavior.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
