Question
2.There is a data structure called a drop-out stack that behaves like a stack in every respect except that the size is fixed. If the
2.There is a data structure called a drop-out stack that behaves like a stack in every respect except that the size is fixed. If the stack size is n, the bottom element is lost when the n+1element is pushed onto the top. Implement a drop-out stack using links, by modifying the LinkedStackcode that you completed as part of Lab 3.
The driver should create a stack of moderate size (say five) and push on that many String elements consisting of peoples names (include your own). Output the contents of the stack and the results of the size() and peek() operations. Push two more elements onto the stack, outputting the contents and the results of the size() and peek() operations for each. (Adapted from PP 13.8.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started