Question: Design your implementation of the circular double-ended queue (deque). Your implementation should support following operations: MyCircularDeque(k): Constructor, set the size of the deque to be

Design your implementation of the circular double-ended queue (deque).

Your implementation should support following operations:

  • MyCircularDeque(k): Constructor, set the size of the deque to be k.
  • insertFront(Object o): Adds an item at the front of Deque. Return true if the operation is successful.
  • insertLast(Object o): Adds an item at the rear of Deque. Return true if the operation is successful.
  • deleteFront(): Deletes an item from the front of Deque. Return true if the operation is successful.
  • deleteLast(): Deletes an item from the rear of Deque. Return true if the operation is successful.
  • getFront(): Gets the front item from the Deque. If the deque is empty, return false.
  • getRear(): Gets the last item from Deque. If the deque is empty, return false.
  • isEmpty(): Checks whether Deque is empty or not.
  • isFull(): Checks whether Deque is full or not.

Now, write a driver program (the class with the public static void main(String[] args) method) name testDeque.java to test the MyCircularDeque data structure you just created. That is, you must test all the above methods.

-For those that are not returning a value, print a message that indicate if it successfully completed its task.

-After you test each method, please print the queue.

-To test the Deque, you must randomly generate 15 integer numbers ranging from 1 to 25 and add to the Deque you created

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!