Q5 - push(e and pop and implement the method min Note that...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Question 5. Minimum Value Stack You are designing a new class MinStack that specializes the java.util.Stack class to Comparable objects and provides a new method min () that will return the minimum value on the stack in O(1) time. In order to provide this functionality you will have to define some new private instance variables, provide a constructor for MinStack (with no parameters), override methods
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: push (e) and pop (), and implement the method min (). Note that the new class uses generics and should work on any subclass of Comparable . Here is a test program testMinStack that provides a test case. You should, however, test your program using a broader range of test cases. Pay particular attention to boundary conditions....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online