Application of Stack Stack follows LIFO principle (Last In First Out).
In this application we directly use Stack as header file as a #include
but if we can write a separate code to handle all task perform by stack like 1)push: store /onsert data in stack 2)pop: remove the data from stack 3)isempty: check stack is empty or not (top==-1) 4)isfull: check stack is full or not 5)topmostelements: its return top most element on the stack
This application is done binary numbers addition using stack operation, for this we required 3 stack one for first binary number, second for second binary number and third one for storing a result. Its very easy to perform opeartions on binary numbers like addition ,sunstraction etc with the help of stack. eg. addition of 2 binary number (having same or different length) binary no1: 101 binary no2: 10
Addition: 111