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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started