Question
import java.util.Iterator; public class ThreeTenStack { //storage - you MUST use this for credit! //Do NOT change the name or type //NOTE: you cannot use
import java.util.Iterator;
public class ThreeTenStack
//storage - you MUST use this for credit! //Do NOT change the name or type //NOTE: you cannot use any arrays or JCF instances in your implementation. private ThreeTenDLList
}
public void push(T item) { //push an item onto the ThreeTenStack //you may assume the item is not null //O(1)
} public T pop() { //pop an item off the ThreeTenStack //if there are no items on the ThreeTenStack, return null //O(1) //default return, remove or update as needed return null;
} public T peek() { //return the top of the ThreeTenStack (but don't remove it) //if there are no items on the ThreeTenStack, return null //O(1) //default return, remove or update as needed return null;
}
public String toString() { //Create a string of the ThreeTenStack where each item //is separated by a space from bottom to top, that is: // - the bottom of the ThreeTenStack should be shown to the left; and // - the top of the ThreeTenStack should be shown to the right //Hint: Reuse the provided code from another class //instead of writing this yourself! //O(n) where n is the number of items in stack //default return, remove or update as needed return null;
} public boolean isEmpty() { //return whether or not the ThreeTenStack is empty //O(1) //default return, remove or update as needed return false;
}
public ThreeTenStack
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started