3. A Stack is data structure in which
addition of new element or deletion of
existing element always takes place at a
same end. This end is known as the top of
the stack. That means that it is possible
to remove elements from a stack in
reverse order from the insertion of
elements into the stack.
INTRODUCTION
4. Stacks entered the computer science
literature in 1946, in the computer design
of Alan M. Turing (who used the terms
"bury" and "unbury") as a means of calling
and returning from subroutines Subroutine
had already been implemented in
KonradZuse in 1945. Klaus Samelso and
Friedrich L. Bauer of Technical University
Munich proposed the idea in 1955 and filed
a patent in 1957. The same concept was
developed, independently, by the Australian
Charles Leonard Hamblin in the first half of
1957.
HISTORY
5. Defination : Stack is a non primative and linear
data structure.
Operation of stack:
i)Insertion[PUSH( )] .
ii)Deletion [POP ( )].
iii)Top ( ).
iv)Empty( ).
v)Is Full( ).
STACK
6. It is a function that is used to insert items
into stack.
In PUSH there is a overflow of items in Stack.
If top =max then print STACK OVERFLOW
PUSH
7. It is a function used to delete items from
stack.
In POP there is underflow of items in stack.
If top=0 then print stack underflow.
POP
8. ๏ REVERSING A LIST.
๏ POLISH NOTATION
๏ CONVERSION OF INFIX TO POSTFIX
EXPRESSION
๏ EVALUTION OF POSTFIX EXPRESSION
๏ CONVERSION OF INFIX TO PREFIX
EXPRESSION
๏ EVALUTION OF PREFIX EXPRESSION
๏ RECURSION
APPLICATION OF
STACK
9. It is the method of writing operation of
an expression neither before there
operants or after them is called polish
notation.
There are 3 types of polish notation:
i)Infix notation eg : A+B
ii)Prefix notation eg : +AB
iii)Postfix notation eg : AB+
POLISH
NOTATION
10. 1) The order in which the operators appear is
not reversed.
2) When the '+' is read, it has lower
precedence than the '*', so the '*' must be
printed first.
3) We will show this in a table with three
columns. The first will show the symbol
currently being read.
4) The second will show what is on the stack
and the third will show the current contents
ALGORITHM :
INFIX TO POSTFIX
CONVERSION
13. 1) Push โ)โ onto STACK, and add โ(โ to end of
the A.
2) Scan A from right to left and repeat step 3
to 6 for each element of A until
the STACK is empty.
3) If an operand is encountered add it to B.
4) If a right parenthesis is encountered push
it onto STACK
ALGORITHM :
INFIX TO PREFIX
EXPRESSION
16. Recursion is an approach in which a
function calls itself with an argument.
Upon reaching a termination condition,
the control returns to the calling
function.
RECURSION