Question
Please rewrite the following code so that after the first doubling of the array, halve the size of the array if fewer than half of
Please rewrite the following code so that after the first doubling of the array, halve the size of the array if fewer than half of the arrays locations are occupied by current stack entries.
in C++
Thank you
#include //main method int main() { //initialize an object of ADTStack ADTStack stack; //push and pop operations only for testing purpose stack.push(20); //pushed element 20 stack.push(30); //pushed element 20 stack.push(40); //pushed element 20 stack.push(50); //pushed element 20 stack.push(60); //pushed element 20 stack.push(70); //pushed element 20 stack.push(80); //pushed element 20 stack.display(); //display the contents of stack stack.pop(); //pop one element stack.display(); //now again display the contents of stack return 0; }
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