Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago