In C++, Write a program using linked list (not STL List) and mimic the stack push and pop operations in list's insert and delete functions. If you don't know about stack, stack follows Last In First Out (LIFO) pattern. Any item inserted in the stack first can be removed at last. Your linked list's insert and delete functions should insert the nodes in the linked list in such a way that the last inserted item could be removed first and first element could be removed last. For insertion, a node must be inserted from back end (not at head or middle) You can use the following structure for the node or any other of your choice. struct Node { int data; Node * next; }; Note: Write constructors (if applicable), use menu to offer choice to the user such as insert, delete, display , size and exit.
In C++,
Write a program using linked list (not STL List) and mimic the stack push and pop operations in list's insert and delete functions. If you don't know about stack, stack follows Last In First Out (LIFO) pattern. Any item inserted in the stack first can be removed at last. Your linked list's insert and delete functions should insert the nodes in the linked list in such a way that the last inserted item could be removed first and first element could be removed last. For insertion, a node must be inserted from back end (not at head or middle)
You can use the following structure for the node or any other of your choice.
struct Node
{
int data;
Node * next;
};
Note: Write constructors (if applicable), use menu to offer choice to the user such as insert, delete, display , size and exit.
Step by step
Solved in 2 steps with 1 images