HOW INSERTION AND DELETION TAKE PLACE IN STACK:-
=>FOR INSERTION
first of all increment take place in TOP and then item insert.
*IN TERMS OF ALGO
TOP=TOP+1
STACK[TOP]=ITEM
=>FOR DELETION
First of all delete item and then decrement in TOP
*IN TERMS OF ALGO
STACK[TOP]=ITEM
TOP=TOP-1.
APPLICATION OF STACK:-
1) Conversion of infix expression to postfix expression.
2) evaluation of postfix expression.
3) quick sort ( study later ).
4) graph traversal technique(DFS)
5) Check for balance paranthesis.
6) postponed decisions.
*POLISH NOTATION
3 TYPES
1) infix-operator is between the operand
2)prefix-operator is before the operand
3)postfix-operator is after the operand.
*ORDER OF PRECDENCE OF SYMBOLS-
=> $
=> * or /
=> + or -
Kindly Share The Love »»
|
|
Tweet | Save on Delicious |
No comments:
Post a Comment