Question: Stack with max in JAVA. Create a data structure MaxStack that efficiently supports the stack operations (push and pop) and also a return-the-maximum operation (note:

Stack with max in JAVA. Create a data structure MaxStack that efficiently supports the stack operations (push and pop) and also a return-the-maximum operation (note: this does not remove the max from the stack). Assume the elements are numbers so that you can compare them. (Hint: what happens when the max value is popped ?). Answer the following questions in the README file

1. What is the average case running time

2. Does your datastructure use any additional memory?

3. Can the use of addiitional memory help improve your running time?

4. Have you considered approaches where the cost may be amortized? if so, what are they?

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!