The Problem
Integer numbers must be loaded into and stored in a stack such that the largest value is always stored at the top position (that is the numbers are kept sorted in decreasing order).
The numbers are read by the program from a file. The numbers in the file are not necessarily sorted.
The stack must be linked list based.
Generic implementation is required, that is, the data in the nodes must be objects. Use the Integer type at instantiation for data rather than int.
The implementation must be tested and the result (decreasing storage) verified.
Determine the big-Oh for the performance of your algorithm
Analysis and Design
Make a careful design before implementation. Decide about the classes and additional methods needed to load up the stack.
Write a pseudo-code (attach it as a comment after the Application class).
Implementation and Testing
When a new element is added to the stack, one or more elements may have to be popped, since the new value may not be greater than the current top value.
You will need a temporary storage for these popped elements before they can be pushed back. You must use a second stack for temporary storage .
Document your program.