Saturday, 30 March 2013

Difference Between Stack and Queue

No.
Stack
Queue
1
Stack is a data structure in which elements are added and removed from only one end, which is called the top.
A queue is a data structure in which elements are added from one end (from back) and are removed from another end (from front).
2
In Stack only two operations are allowed: PUSH (to add elements),
PULL (to remove  elements).
Queue uses two operations are: ENQUEUE (to add elements), DEQUEUE (to remove elements).
3
It Works on LIFO (Last in first out principle).
It works on FIFO (first in first out principle).
4


No comments:

Post a Comment