Question: A double-ended queue or deque (pronounced deck) is a collection that is a combination of a stack and a queue. Write a class Deque that

A double-ended queue or deque (pronounced "deck") is a collection that is a combination of a stack and a queue. Write a class Deque that uses a linked list to implement the following API:

public class Deque Deque () boolean isEmpty() void enqueue (Item item) void

public class Deque Deque () boolean isEmpty() void enqueue (Item item) void push(Item item) Item pop() Item dequeue () create an empty deque is the deque empty? add item to the end add item to the beginning remove and return the item at the beginning remove and return the item at the end API for a generic double-ended queue

Step by Step Solution

3.41 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Sure I can provide you with a class Deque that implements the given API using a linked list in Java Below is a simple implementation of such a class j... View full answer

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 Algorithm Design Questions!