title: Stack with find-min/find-max more efficient than O(n)?
body: <p>I am interested in creating a Java data structure similar to a stack that supports the following operations as efficiently as possible:</p>
  
  <ul>
  <li>Push, which adds a new element atop the stack,</li>
  <li>Pop, which removes the top element of the stack,</li>
  <li>Find-Max, which returns (but does not remove) the largest element of the stack, and</li>
  <li>Find-Min, which returns (but does not remove) the smallest element of the stack, and</li>
  </ul>
  
  <p>What would be the fastest implementation of this data structure?  How might I go about writing it in Java?</p>