Question
Implement a 'stack' class with a linked list. C++ //-------------------------------------------------------------------------------------------- class stack { private: class node { public: double data; node *next; node() { data
Implement a 'stack' class with a linked list. C++ //-------------------------------------------------------------------------------------------- class stack { private: class node { public: double data; node *next; node() { data = x; next = NULL; } }; public: stack() { head = NULL; tail = NULL; } ~stack() //desconstructor, called automatically when object goes out of scope { popAll(); } void push(double x) { //insert code here } //push x onto the top of the stack double pop() { //insert code here } // remove and return top item from stack bool empty() { //insert code here } // is stack empty void popAll { //insert code here } //remove all items from the stack };
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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