Save
MIDTERM_2ND SEM.1
Data Structure & Algorithm Analysis
QUEUE
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
rein
Visit profile
Cards (10)
Queue
Linear data structure
First in
, First Out principle.
Queue in C++ (using STL)
C++
provides a built-in queue container in the
Standard Template Library
(STL), which allows easy implementation
STL(push(x))
Adds
an element x to the
back
of the queue (enqueue).
STL(pop())
Removes
the
front
element of the queue (dequeue).
STL(front())
Returns the
front
element of the
queue.
STL(back())
Returns the
last
element of the
queue.
STL(size())
Returns the
number
of elements in the
queue
.
STL(empty())
Returns true if the queue is
empty
, otherwise false.
Queue
First element inserted into the queue is the first one to be
removed.
Empty
returns true if the
queue
is
empty
, otherwise false