Science Fair Projects Ideas - Queue

All Science Fair Projects

      

Science Fair Project Encyclopedia for Schools!

  Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary     

Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

Queue

For queueing people, see queue area. A queue is also a style of braided hair.


In providing services to people, and in computer science, transport and operations research a queue is a First-In-First-Out FIFO process — the first element in the queue will be the first one out. This is equivalent to the requirement that whenever an element is added, all elements that were added before have to be removed before the new element can be removed.

This article discusses the queue data structure.

One characteristic of a queue is that it does not have a specific capacity. Regardless of how many elements are already contained, a new element can always be added. It can also be empty, at which point removing an element will be impossible until a new element has been added again.

A practical implementation of a queue usually does have some capacity limit, that depends on the concrete situation it is used in. For a data structure the executing computer will eventually run out of memory, thus limiting the queue size. For a waiting queue of people, eventually there might not be enough space to squeeze into, or people might decide that the queue is already too long and not bother adding themselves to it.

In computer science, compare:

Implementation in Scheme

The following functional implements queues as a persistent data structure, representing the queue as a pair of lists. The queue elements are the elements in the front followed by (in reverse order) the elements in the back. The time for enqueue and dequeue are O(1) amortized time.

 (define make-queue cons)
 (define queue-front car)
 (define queue-back  cdr)

 (define empty-queue (cons '() '()))

 (define (enqueue Q x)
   (make-queue (queue-front Q) 
               (cons x (queue-back Q))))

 (define (dequeue Q)
   (cond
     [(and (null? (queue-front Q)) (null? (queue-back Q)))
      (error "dequeue: The queue is empty")]
     [(null? (queue-front Q))
      (dequeue (make-queue (reverse (queue-back Q)) '()))]
     [else
      (values (car (queue-front Q)) 
              (make-queue (cdr (queue-front Q)) (queue-back Q)))]))

See also

The Oroogu programming language relies on queues as its only data structure

External links

03-10-2013 05:06:04
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details
Science kits, science lessons, science toys, maths toys, hobby kits, science games and books - these are some of many products that can help give your kid an edge in their science fair projects, and develop a tremendous interest in the study of science. When shopping for a science kit or other supplies, make sure that you carefully review the features and quality of the products. Compare prices by going to several online stores. Read product reviews online or refer to magazines.

Start by looking for your science kit review or science toy review. Compare prices but remember, Price $ is not everything. Quality does matter.
Science Fair Coach
What do science fair judges look out for?
ScienceHound
Science Fair Projects for students of all ages
All Science Fair Projects.com Site
All Science Fair Projects Homepage
Search | Browse | Links | From-our-Editor | Books | Help | Contact | Privacy | Disclaimer | Copyright Notice