Question: IN JAVA The Problem Integer numbers must be loaded into and stored in a stack such that the largest value is always stored at the

IN JAVA

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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!