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

Representation of a Graph ?

Representation of a  graph is the way of storing data values in  memory location as graph data structure. There are two types  of graph representation techniques. 1. Adjacency ma...

What is Spanning Tree?

Spanning tree: A spanning tree for an undirected graph G is a graph consisting of all the nodes of ‘G’ together with enough edges from G such that 1.There is a path b/w each pair of nodes i...

What is Binary Tree and Representation of Binary Tree?

Binary Tree: A binary tree is also a tree which is either empty or non empty . If it is non empty it should satisfy the following properties. 1. one of the element is identified as root. ...

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