Pages

Categories

Queue

Queue
Published on 10 March, 2014
The queue data structure is a first in, first out type that has two core operations, enqueue, and
dequeue. The queue needs to keep track of two pieces of data, the head of the queue, and the
tail of the queue. The head of the queue points to the value that is to be first dequeued, and
the tail of the queue points to where new values are to be appended onto. The queue data
structure is very useful as it can be used to act as a buffer for incoming data that needs to be
processed in order of arrival; for example in networking or events in an operating system.
Definitions:
 Head of Queue – A pointer to where values are to be taken from.
 Tail of Queue – A pointer to where values are to be appended to.
Operations:
 Create – Creates a queue.
 Enqueue – Appends a value to the tail of the queue.
 Dequeue – Takes the value at the head of the queue.
Diagram:
Filed in Computer Science Revision | No replies