Stack in C: Presented by Himangku Saikia Manash Jyoti Chetri Sunny Peter Dhanwar Pradyut Prakash Das
Stack in C: Presented by Himangku Saikia Manash Jyoti Chetri Sunny Peter Dhanwar Pradyut Prakash Das
PRESENTED BY Himangku saikia Manash jyoti chetri Sunny peter dhanwar Pradyut prakash das
Definition of stack
Stack is an ordered collection of items into which items may be inserted and from which items may be deleted at one end, called the top of the stack. The other end of the list lies inactive is termed as bottom of stack. PRINCIPLE - LIFO ( Last In First Out ) .
OPERATIONS ON STACK
Mainly the are two operations on stack . They are as follows. 1. PUSH 2. POP
REPRESENTATION OF STACK IN C
STACK IMPLEMENTATION
The stack implementation is mainly done in two ways. They are as follows. 1.Static implementation. 2.Dynamic implementation.
Static implementation:
Static implementation is a simple method which can be done using arrays,but it has few limitations. During a program execution the size of an array cannot be modified once it has been declared.
DYNAMIC IMPLEMENTATION
1. The dynamic implementation is done using pointers. 2 .On the run time there is no restiction on the number of elements when we are using pointer implementation
APPLICATIONS OF STACK..
STACKS HAVE NUMEROUS APPLICATIONS. WE SEE STACKS IN EVERYDAY LIFE, FROM THE BOOKS IN OUR LIBRARY, TO THE SHEAF OF PAPERS THAT WE KEEP IN OUR PRINTER TRAY. ALL OF THEM FOLLOW THE LAST IN FIRST OUT (LIFO) LOGIC, THAT IS WHEN WE ADD A BOOK TO A PILE OF BOOKS, WE ADD IT TO THE TOP OF THE PILE, WHEREAS WHEN WE REMOVE A BOOK FROM THE PILE, WE GENERALLY REMOVE IT FROM THE TOP OF THE PILE.
A FEW APPLICATIONS OF STACKS IN THE WORLD OF COMPUTERS ARE IN THE NEXT SLIDE.
4. recursion