Computer-Science-A-level-Ocr
-
3-3-networks8 主题
-
3-2-databases7 主题
-
3-1-compression-encryption-and-hashing4 主题
-
2-5-object-oriented-languages7 主题
-
2-4-types-of-programming-language4 主题
-
2-3-software-development5 主题
-
2-2-applications-generation6 主题
-
2-1-systems-software8 主题
-
1-3-input-output-and-storage2 主题
-
1-2-types-of-processor3 主题
-
1-1-structure-and-function-of-the-processor1 主题
-
structuring-your-responses3 主题
-
the-exam-papers2 主题
-
8-2-algorithms-for-the-main-data-structures4 主题
-
8-1-algorithms10 主题
-
7-2-computational-methods11 主题
-
7-1-programming-techniques14 主题
-
capturing-selecting-managing-and-exchanging-data
-
entity-relationship-diagrams
-
data-normalisation
-
relational-databases
-
hashing
-
symmetric-vs-asymmetric-encryption
-
run-length-encoding-and-dictionary-coding
-
lossy-and-lossless-compression
-
polymorphism-oop
-
encapsulation-oop
-
inheritance-oop
-
attributes-oop
-
methods-oop
-
objects-oop
-
capturing-selecting-managing-and-exchanging-data
-
6-5-thinking-concurrently2 主题
-
6-4-thinking-logically2 主题
-
6-3-thinking-procedurally3 主题
-
6-2-thinking-ahead1 主题
-
6-1-thinking-abstractly3 主题
-
5-2-moral-and-ethical-issues9 主题
-
5-1-computing-related-legislation4 主题
-
4-3-boolean-algebra5 主题
-
4-2-data-structures10 主题
-
4-1-data-types9 主题
-
3-4-web-technologies16 主题
-
environmental-effects
-
automated-decision-making
-
computers-in-the-workforce
-
layout-colour-paradigms-and-character-sets
-
piracy-and-offensive-communications
-
analysing-personal-information
-
monitoring-behaviour
-
censorship-and-the-internet
-
artificial-intelligence
-
the-regulation-of-investigatory-powers-act-2000
-
the-copyright-design-and-patents-act-1988
-
the-computer-misuse-act-1990
-
the-data-protection-act-1998
-
adder-circuits
-
flip-flop-circuits
-
simplifying-boolean-algebra
-
environmental-effects
Queues
What is a queue?
-
A queue is a First in First out (FIFO) data structure
-
Items are added to the end of the queue and removed from the front
-
Imagine a queue in a shop where customers are served from the front and new customers join the back
-
-
A queue has a back (tail) pointer and a front (head) pointer
-
Much the same as with a stack, an attempt to enqueue an item when the queue is full is called a queue overflow. Similarly, trying to dequeue an item from an empty queue is called a queue underflow.
-
A queue can be static or dynamic
-
There are three types of queues
-
Linear Queue
-
Circular Queue
-
Priority Queue
-
Main operations
|
Operation |
Description |
|---|---|
|
|
Adding an element to the back of the queue |
|
|
Returning an element from the front of the queue |
|
|
Return the value of the item from the front of the queue without removing it from the queue |
|
|
Check whether the queue is empty |
|
|
Check whether the queue is full (if the size has a constraint) |
Queue keywords
|
Keyword |
Definition |
|---|---|
|
Queue |
An abstract data structure that holds an ordered, linear sequence of items. It is a First in First out structure. |
|
FIFO |
First In First Out |
|
Static Data Structure |
Has a fixed size and can’t change at run time. |
|
Dynamic Data Structure |
Able to adapt and accommodate changes to the data inside it so it doesn’t waste as much space in memory. |
|
Pointer |
An object that stores a memory address |
Linear Queues
What are linear queues?
-
A linear queue is a data structure that consists of an array.
-
Items are added to the next available space in the queue starting from the front
-
Items are then removed from the front of the queue

Enqueue data
-
Before adding an item to the queue you need to check that the queue is not full
-
If the end of the array has not been reached, the rear index pointer is incremented and the new item is added to the queue
-
In the example below, you can see the queue as the data Adam, Brian and Linda are enqueued.




Dequeue data
-
Before removing an item from the queue, you need to make sure that the queue is not empty
-
If the queue is not empty the item at the front of the queue is returned and the front is incremented by 1
-
In the example below, you can see the queue as the data Adam is dequeued

Circular Queues
What are circular queues?
-
In A Level Computer Science, a circular queue is a static array that has a fixed capacity
-
It means that as you add items to the queue you will eventually reach the end of the array
-
When items are dequeued, space is freed up at the start of the array
-
It would take time to move items up to the start of the array to free up space at the end, so a Circular queue (or circular buffer) is implemented
-
It reuses empty slots at the front of the array that are caused when items are dequeued
-
As items are enqueued and the rear index pointer reaches the last position of the array, it wraps around to point to the start of the array as long as it isn’t full
-
When items are dequeued the front index pointer will wrap around until it passes the rear index points which would show the queue is empty

Enqueue data
-
Before adding an item to the circular queue you need to check that the array is not full
-
It will be full if the next position to be used is already occupied by the item at the front of the queue
-
If the queue is not full then the rear index pointer must be adjusted to reference the next free position so that the new item can be added
-
In the example below, you can see the circular queue as the data Lauren is enqueued.
<div class=”mb
Responses