Difference Between Stack And Queue in Tabular Form

SNo.Basic TermsStackQueue
1.DefinitionStack is a linear data structure which follows a
particular order in which the operations are
performed.a Stack is open at one ends.
Queue is an abstract data structure, somewhat
similar to Stacks.Unlike stacks, a queue is
open at both its ends.
2.Sequence of Elements
Processing
LIFO Last In First OutFIFO First Come First Out
3.Number of pointers
used
1 Pointers2 Pointers
4.Operations performedPush and PopEnqueue and dequeue
5.RepresentationVerticalHorizontal
6.Reference for data processingStack contains TOPQueue contains REAR and FRONT
7.Position of data itemsdata items are inserted and deleted from
the same end.
data items in a queue are inserted and deleted
from different ends.
8.Element insertedFirst insertedInsertion at REAR end
9.Element deletedLast insertedDeletion at FRONT end.
10.ApplicationUsed in infix to postfix conversion,
scheduling algorithms, depth first
search and evaluation of an expression.
A Queue offers services in operations research,
transportation and computer science that
involves persons,data, events and objects
to be stored for later processing.
11.Real Example
  • Collection of dinner plates at a
    wedding reception
  • Collection of Coins
  • People standing in a file to board a bus
  • Cars at Narrow Road
12.Different TypeNo
  • Simple Queue
  • Circular Queue,
  • Priority Queue,
  • (Dequeue)doubly Ended
    Queue.
13.check if fullTOP == MAX – 1REAR == MAX – 1
14.check If emptyTOP == -1FRONT == REAR
15.Diagram

Stack Diagram
Stack Diagram

Queue Diagram
Queue Diagram

 

(Visited 1,807 times, 1 visits today)
Share with Friends :
Written by:

Leave a Reply

Your email address will not be published. Required fields are marked *