Question: A deque (double-ended queue) is a data structure that allows you to push and pop from one end (tail) like a stack, and dequeue from
A deque (double-ended queue) is a data structure that allows you to push and pop from one end (tail) like a stack, and dequeue from the other end (front) like a queue. Create a LinkedListed-based unbounded Deque class that provide the following methods: push, pop, dequeue, and size(). You do not need to enlarge in the implementation. A main function should be created to test each of those methods.
Here is the Linked List Node Class that the deque can be based on:
public class LLNode{ private LLNode link; private T info; public LLNode(T info) { this.info = info; link = null; } public void setInfo(T info) // Sets info of this LLNode. { this.info = info; } public T getInfo() // Returns info of this LLONode. { return info; } public void setLink(LLNode link) // Sets link of this LLNode. { this.link = link; } public LLNode getLink() // Returns link of this LLNode. { return link; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
