Stacks, Queues and Deques
Xiaoping Zhang
School of Mathematics and Statistics, Wuhan University
,Table of contents
1. Stacks
2. Queue
3. Double-Ended Queues
1
,Stacks
, Stacks
Definition
A stack is a collection of objects that are inserted and removed ac-
cording to the last-in, first-out (LIFO) principle.
A user may insert objects into a stack at any time, but may only access
or remove the most recently inserted object that remains (at the so-called
“top”of the stack).
2