Stack & Queue Notes
Stack & Queue Notes
Stack
followS a
Stack is a lineas data stxuctuxe that
0xdex in which the ope3ations
are pertormed.
paxticulax
LIFOCLast In Fivst Out)
0T
stack.
Thexe ase many veal-lite examples of a
stacked over one
Conside an example 0 plates
canteen. The plate which is at the
another in the
i.e. the plate
top is the fiast one to be xemoved,
which has been placed at the bottom-most position
emains in the Stack for the longest peviod of time.
So, it can be simply Seen to follow LIFOCLast.In
Fist Out)
oxdex.
FILO CFiast In Last Out)
Shubham Upadhyay CLinkedIn)
Queue
A Queue is defined as a lineas datq structuze that
is Open at both ends and the opebations ae peafoamed
ordex.
in Fixst In Fixst Out CFI F0)
Dequeue
B45 Engueve
2
Queue Datq Structve
Charactesistics of Queue
Queue can handle multiple data.
We can access both ends.
fast and flexible.
Tne
They are
Shubham UpadhyayCLinkedIn)
Queue Representation
Like stacks, Queves Can also be vepresented in an
the Gueue is
aray In this Tepresentation, implemented
Vasiables used in this Case axe
USing the array
of the array queue elements.
storing
Queue. the name
the First element is stored
o Front: the îndex where
thequeue.
in the aray epvesenting
where the last
element is stored în an
Reas: the index
epresenting the queue.
arayaray
Such
such Notes.)
Notes:)
Foz moze