Flowchart for Stack using Linked List
This flowchart represents the operations of a stack implemented using a linked list. The
operations include Push, Pop, and Display with a menu-driven approach.
Flowchart Steps:
1. Start
2. Initialize top = NULL
3. Display Menu:
- 1. Push
- 2. Pop
- 3. Display
- 4. Exit
4. User Choice:
- If choice == 1 (Push):
- Enter element
- Create new node
- Set new_node->nxt = top
- Update top = new_node
- If choice == 2 (Pop):
- If top == NULL, print 'Stack underflow'
- Else, store top->data
- Update top = top->nxt
- Free previous top node
- Print popped element
- If choice == 3 (Display):
- If top == NULL, print 'Stack empty'
- Else, traverse stack and print elements
- If choice == 4 (Exit):
- Terminate program
- Else, print 'Invalid Choice'
5. Ask user if they want to continue (Yes/No)
6. Repeat from Step 3 if Yes, else Stop