Stack Using Linked List

Let us see in the below program how stack can be implemented using Linked List. #include <iostream>using namespace std;typedef struct node{ int data; struct node* next; }Node;class stack{private: Node* head;public: stack() { head = NULL; } ~stack() { while (NULL != head) { Node* temp = head; head = head ->next; delete temp; } } void push(int data) { Node* temp = new Node; temp->data = data; if (NULL == head) { head = temp; head->next = NULL; return; } temp->next = head; head = temp; } int pop() {…