Showing posts with label sortableStack implementation. Show all posts
Showing posts with label sortableStack implementation. Show all posts

9/1/11

SortableStack implementation in Java

I am implementing an interface for Stack which will help to push and pop in O(n) time and help in finding the highest, lowest and the middle element in O(1) time.


I will be using Arraylist (since I m using a standard jdk 6 and not some other package) because with using this we can implement the above interface in the least possible time.