Write about Stacks ?


Stack is a linear data structure in which elements inserted in a linear fashion.

Stack is a linear data structure in which elements inserted or deleted at any one end called top.

stack


FILO:(first in last out):

The element entered first into the stack is the element deleted last from the stack.

LIFO(last in first out):

The   element entered last in to the stack is the element deleted first from the stack.

Stack Applications :

    1.    Tower of Hanoi :
tower of henoi


    2.    Evaluation of Postfix Expression :

evaluating expression


5 *(6+2) – (12/4)
Post fix 5,6,2,+,*,12,4,%,-


Stack Operations:

1.            Push

2.            Pop

3.            Visit(or)display

Push : to insert a new element into stack.

Pop :delete a existing element from stack.

Display : to visit the element.

Stack over flow :

 There is no room to insert a new element in to the stack.

 First check for room in stack . while inserting element.

Stack under flow :
          
There is no element in the stack to delete.


While deleting we must check stack is under flow or not.






Related

Data Structures 1719854856849384229

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item