CSC 2200 Lecture Notes - Lecture 7: Abstract Data Type
9 views4 pages
CSC 2200 lecture 7
o Queue is an abstract data structure, somewhat similar to Stacks.
o Unlike stacks, a queue is open at both its ends.
o One end is always used to insert data (enqueue) and the other is used to remove
o Queue follows First-In-First-Out methodology, i.e., the data item stored first will
be accessed first.
o A real-world example of queue can be a single-lane one-way road, where the
vehicle enters first, exits first.
o More real-world examples can be seen as queues at the ticket windows and bus-
• Queue representation
o As in stacks, a queue can also be implemented using Arrays, Linked-lists, Pointers
o For the sake of simplicity, we shall implement queues using one-dimensional
• Basic operations