Code:
import java.util.*;
public class MaxStackTest {
public static void main(String[] args) {
MaxStack<Integer> maxStack = newMaxStack<Integer>();
// Add your code here to test allmethods of MaxStack class
}
}
class MaxStack<T extends Comparable<T>>{
// this class could use O(n) space in addition to whatis required for
// the elements themselves.
// Y could be either T or class name of an additionalclass you design
LinkedList<Y> itemList = newLinkedList<Y>();
// add your code here if needed
void push(T item) {
// add your code here to insert itemto itemList
//
OR
OR