Site hosted by Angelfire.com: Build your free website today!

Queues 1 (using array, abstract version)

by Vangelis Livadiotis

 

Queues are a familiar aspect of everyday life: people often wait in-line for a bus or to be served in a bank.

 

Queues are commonplace in computing: in a real-time system, there are queues of processes waiting to use processor(s), queues of jobs waiting to use a computing resource, e.g., a printer, etc.
The general concept of a queue is a line of objects that has a front and a rear: the first object in the queue is at the front of the queue and the last object is at the rear of the queue; objects join at the rear and leave from the front
 

Queues operate on a First In First Out (FIFO) basis

 

A queue is a commonly occurring data structure with the properties that we can:

Add a value to the back of the queue
Remove the value from the front of the queue
Discover the Size of the queue
A queue needs to keep track of the front (head) and back (tail) positions.
 

The applet represents the more abstract representation of a queue. The code based representation is shown in this applet.

The full Pascal code for a queue is given here.

Instructions:

The following applet represents a simple queue at a shop. You just enter a customers name and click Add to add him to the queue. Suppose each customer is new information in a system. The first information going in is the first one to leave. 

Next Applet on Queues (based on the code provided) ->

 

Home | Arrays | Arrays2 | Queues1 | Queues2 | Stacks | Arguments | Pointers |

Binary Search Tree

 

* Code taken from Lecture 2 in Data Structures Semester 2 2005 by Mr. Chris Cox for Oxford Brookes University.

Copyright © June 2005 - Author Vangelis Livadiotis