0% found this document useful (0 votes)
57 views11 pages

5.1.8 Queue

This document provides an overview of abstract data structures including two-dimensional arrays, stacks, queues, linked lists, and binary trees. It focuses on queues, describing their first-in, first-out nature and the three primary queue methods of enqueue, dequeue, and isEmpty. Examples are given of algorithms to move elements from an array into a queue and to print all values from a queue. Real-world applications of queues like printer queues and modeling physical queues are also mentioned.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views11 pages

5.1.8 Queue

This document provides an overview of abstract data structures including two-dimensional arrays, stacks, queues, linked lists, and binary trees. It focuses on queues, describing their first-in, first-out nature and the three primary queue methods of enqueue, dequeue, and isEmpty. Examples are given of algorithms to move elements from an array into a queue and to print all values from a queue. Real-world applications of queues like printer queues and modeling physical queues are also mentioned.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Abstract Data

Structures
IB Computer Science

Content developed by
Dartford Grammar School
Computer Science Department
HL Topics 1-7, D1-4

1: System design 2: Computer 3: Networks 4: Computational


Organisation thinking

5: Abstract data 6: Resource 7: Control D: OOP


structures management

Content developed by Dartford Grammar School Computer Science Department


1: System design

HL only 5 Overview 2: Computer


Organisation

Thinking recursively
5.1.1 Identify a situation that requires the use of recursive thinking
3: Networks
5.1.2 Identify recursive thinking in a specified problem solution
5.1.3 Trace a recursive algorithm to express a solution to a problem
Abstract data structures
5.1.4 Describe the characteristics of a two-dimensional array 4: Computational
5.1.5 Construct algorithms using two-dimensional arrays
thinking
5.1.6 Describe the characteristics and applications of a stack
5.1.7 Construct algorithms using the access methods of a stack
5.1.8 Describe the characteristics and applications of a queue
5.1.9 Construct algorithms using the access methods of a queue 5: Abstract data
5.1.10 Explain the use of arrays as static stacks and queues structures
Linked lists
5.1.11 Describe the features and characteristics of a dynamic data structure
5.1.12 Describe how linked lists operate logically 6: Resource
5.1.13 Sketch linked lists (single, double and circular) management
Trees
5.1.14 Describe how trees operate logically (both binary and non-binary)
5.1.15 Define the terms: parent, left-child, right-child, subtree, root and leaf
5.1.16 State the result of inorder, postorder and preorder tree traversal 7: Control
5.1.17 Sketch binary trees
Applications
5.1.18 Define the term dynamic data structure
5.1.19 Compare the use of static and dynamic data structures
D: OOP
5.1.20 Suggest a suitable structure for a given situation

Content developed by Dartford Grammar School Computer Science Department


Topic 5.1.8
Construct algorithms using the access
methods of a queue

Content developed by Dartford Grammar School Computer Science Department


Abstract Data Structures (ADTs)
• 2D array
• Stack
• Queue
• Linked List
• (Binary) Tree

Content developed by Dartford Grammar School Computer Science Department


Stacks – all about the ENQUEUE and DEQUEUE

Content developed by Dartford Grammar School Computer Science Department


First in, First out

FIFO

Content developed by Dartford Grammar School Computer Science Department


3 Queue Methods

Content developed by Dartford Grammar School Computer Science Department


Example 1: Move from array to queue
Write an algorithm that will move all the elements
from a linear integer array LINE to a queue called Q.

int COUNTER = 0
loop COUNTER from 0 to LINE.length
Q.enqueue(LINE[COUNTER])
end loop

Content developed by Dartford Grammar School Computer Science Department


Example 2: Print values from a queue
Write an algorithm that will print all the String values
kept in a queue called Q.

loop while not Q.isEmpty()


output( Q.dequeue() )
end loop

Content developed by Dartford Grammar School Computer Science Department


Real world examples
• Printer queues
• Computer modelling of physical queues (like in a
supermarket)

Content developed by Dartford Grammar School Computer Science Department

You might also like