Question: Develop and test two classes: a linked list-based stack ADT that implements the provided StackInterface.java a linked list-based queue ADT that implements the provided QueueInterface.java

Develop and test two classes:

  1. a linked list-based stack ADT that implements the provided StackInterface.java
  2. a linked list-based queue ADT that implements the provided QueueInterface.java

These implementations will be considered unbounded because of the use of a linked list for the underlying data structure.

The use of the attached generic singly linked list node class, LLNode.java, is recommended but not required.

Your stack and queue classes MUST be generic.

Please include a toString( ) method in each ADT.

----------

public class LLNode { private E info; private LLNode next; public LLNode(E info) { this.info = info; next = null; } public E getInfo() { return info; } public void setInfo(E info) { this.info = info; } public LLNode getNext() { return next; } public void setNext(LLNode next) { this.next = next; } }-----------------------

public interface QueueInterface {

void enqueue(E element); // add an element to the queue - always at the end of the queue E dequeue(); // remove and return the front of the queue boolean isEmpty(); boolean isFull(); } -----------------------------------

package interfaces;

public interface StackInterface {

void push(E element); // add an element to the stack - always at the "top" E pop(); // remove and return the top of the stack E peek(); // return the top of the stack ... without removing boolean isEmpty(); boolean isFull(); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!