Data Structure Using C (313301) Practical No.17: Write a 'C' Program to perform PUSH and POP Operations on Stack using Linked List
Stacks are a fundamental data structure in computer science and have numerous practical applications based on their LIFO (Last In, First Out) properties. Hence, a stack is a linear data structure where insertion and deletion occur only from one end, called the stack top.
C Program Code
Algorithm
Flow chart
Result
Pushed 10 onto the stack
Pushed 20 onto the stack
Pushed 30 onto the stack
Stack contents:
30
20
10
Popped 30 from the stack
Popped 20 from the stack
Stack contents:
10
Practical Related Questions
1. Write a C program to perform following operations on Stack as Linked List. PUSH (10), PUSH (20), POP, PUSH (10), PUSH (20), POP, PUSH (20), POP.
Answer:
2. What is the time complexity of the push, pop, and peek operations in your implementation?
Answer:
Exercise
1. What are the advantages of using a linked list to implement a stack?
Answer:
2. Give limitations of using Linked List based Stack.
Answer:
Conclusion
We successfully completed Data Structure Using C (313301) Practical No.17and Write a 'C' Program to perform PUSH and POP Operations on Stack using Linked List.