Question: Write anLLStack class that implementstheStack interface given below using alinked list rather than an array (as done in class).YourLLStack class should include all themethods in

Write an LLStack class that implementsthe Stack interface given below using alinked list rather than an array (as done in class).Your LLStack class should include all themethods in the Stack interface(push(), pop(), peek(), isEmpty()) as well as atoString() method. Test this classthoroughly and make sure it works properly, because its essentialfor Part 2! ( Check the other question I posted onCramster)

public interfaceStack

{

// push an item onto the stack

void push(E element);

// pop an item from the stack (and return theitem)

E pop();

// return the item on top of the stack (withoutpopping)

E peek();

// returns whether the stack is empty

boolean isEmpty();

// returns the stack contents as astring

String toString();

}

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!