In this project you will write code for Dequeue data structure. Dequeue is a special kind of a Queue where additions and deletions can be done at both ends. You are to implement Dequeue using a circular array. Dequeue has instance variables front, rear and elements (the array that holds the elements of the Dequeue). Go over the circular array implementation of Queue code is posted in Blackboard.

Recall that, for an empty Queue rear is one-position counter clockwise to front and unfortunately, the same configuration holds for a full queue. To distinguish between a full-queue and an empty queue, we kept track of the number of elements in count instance variable. (if count == 0, the queue is empty, and if count == elements.length, queue is full).

In our implementation of Dequeue, there is no count variable to keep track of the number of elements. Instead, to distinguish a full-queue from an empty queue, we never allow the queue to get completely full. A full queue is one with exactly one empty spot in the array. That way we can distinguish an empty queue and full queue by looking at the relative positions of front and rear.

You are given Dequeue.html which outlines the behavior of each method in Dequeue:

You are to write a Junit test suite to test all the methods including the iterator for Dequeue.

Draw pictures to understand the concepts.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.