Test your knowledge with free interactive questions on Seneca — used by over 10 million students.

Queues

A queue is a data structure where data items are always added to the end and removed from the front. It is often referred to as a 'first in, first out’ data structure.

Queues

Queues

  • Queues can be implemented using other data structures, such as arrays or linked lists.
  • In either case, two extra variables are required to identify the front and rear of the queue.
  • Queues can be ‘static’ (fixed in size) or ‘dynamic’ (able to grow in size as necessary)
Queue operations

Queue operations

  • Several operations can be carried out on queues:
    • enQueue() - adds an item to the rear of a queue.
    • deQueue() - removes and displays the item at the front of a queue.
    • isEmpty() - checks to see if the queue is empty.
    • isFull() - checks to see if the queue is full.
Uses

Uses

  • Queues have a wide range of uses in computer science, including:
    • Storing print jobs until the printer is ready to print.
    • CPU scheduling.
    • Breadth-first traversal of a graph.
Linear or circular

Linear or circular

  • Queues can also be ‘linear’ or ‘circular’.
  • When an item of data is removed from the front of a linear queue, all the other items move up one place.
    • This is only suitable in a small queue, otherwise data processing time can be excessive.
  • When an item of data is removed from the front of a circular queue, the only processing required is to update the two pointers identifying the new front and rear of the queue.
Jump to other topics
1

Components of a Computer

2

Software & Software Development

3

Exchanging Data

4

Data Types, Data Structures & Algorithms

5

Legal, Moral, Cultural & Ethical Issues

6

Elements of Computational Thinking

6.1

Thinking Abstractly

6.2

Thinking Ahead

6.3

Thinking Procedurally

6.4

Thinking Logically

6.5

Thinking Concurrently

7

Problem Solving & Programming

8

Algorithms

Practice questions on Queues

Can you answer these? Test yourself with free interactive practice on Seneca — used by over 10 million students.

  1. 1
    Queue operations:Fill in the list
Answer all questions on Queues

Unlock your full potential with Seneca Premium

  • Unlimited access to 10,000+ open-ended exam questions

  • Mini-mock exams based on your study history

  • Unlock 800+ premium courses & e-books

Get started with Seneca Premium