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
To compl... View full answer
Get step-by-step solutions from verified subject matter experts
