Question: Problem: A deque is a double-ended queue. You can insert items at either end and delete them from either end. The methods might be called
Problem: A deque is a double-ended queue. You can insert items at either end and delete them from either end. The methods might be called insertFront () and insertRear (, and removeFront) and removeRear . A deque provides a more versatile data structure than either a stack or a queue If you restrict yourself to insertFront0 and removeFront) (or their equivalents on the insertRear0 and removeRearO), the deque acts like a stack. If you restrict yourself to insertRear0 and removeFront0 (or the opposite pair, t acts like a queue In this project, you are required to program for two files. The first is Deque.java that is the class definition (Listing 4.4), which should include the following methods. Deque need to support wraparound at the end of the array, as queues do o insertFront0, removeFront0: insert and remove element into the Deque o insertRear0, removeRear0: insert and remove element into the Deque o isEmpty0: if the Deque is empty o isFull0: if the Dqeue is full size(): return the number of items in queue o display0: display all the element from Front to Rear (Hint: You could use book's code insert0 as insertRear0, remove as removeFront0, then rite the similar methods for insertFront) and removeRear0, which both index are decreasing.) The second file is DequeApp.java that is the application to use Deque ADT. You are required to have three objects to show your deque ADT used as a stack, queue, and deque
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
