CSC 2200 Lecture Notes - Lecture 7: Abstract Data Type

9 views4 pages
Published on 19 Jul 2018
Course
CSC 2200 lecture 7
Queues
Queue
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
data (dequeue).
o Queue follows First-In-First-Out methodology, i.e., the data item stored first will
be accessed first.
Example
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-
stops.
Queue representation
o As in stacks, a queue can also be implemented using Arrays, Linked-lists, Pointers
and Structures.
o For the sake of simplicity, we shall implement queues using one-dimensional
array.
Basic operations
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
Monthly
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.