Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions

Question

9. Describe the characteristics of power.

Answered: 1 week ago

Question

3. Identify and describe nine cultural value orientations.

Answered: 1 week ago