Save
OCR A-level Computer Science Paper 1
1.4.2 Data Structures
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Charlie Hadjirallis
Visit profile
Cards (71)
Data Structures
Arrays
Records
Lists
Tuples
View source
Data Structures
Linked List
Graphs
Stack
Queue
Tree
Binary Search
Tree
Hash
Table
View source
Data Structures
1.
Traversing data structures
2.
Adding data
and
removing data
from
data structures
View source
Array
An
ordered
,
finite set
of
elements
of a
single type. Zero-indexed
by
default
View source
Array
oneDimensionalArray = [
1
,
23
,
12
,
14
,
16
,
29
,
12]
twoDimensionalArray = [[
123
,
28
,
90
,
38
,
88
,
23
,
47
],[1, 23,
12
,
14
,
16
,
29, 12
]]
threeDimensionalArray = [[[12,8],[9,6,
19
]],[[241,89,4,1],[
19
,2]]]
View source
Record
More commonly referred to as a
row
in a
file
, made up of
fields
View source
Record
fighterDataType
=
record
integer
ID
string FirstName string Surname end record
View source
Lists are
data structures
consisting of ordered items where items can occur
more than once.
They can contain
elements
of
more than one
data type
View source
List values
are stored
non-contiguously
unlike
arrays
View source
There are a range of
operations
that can be
performed
involving
lists
View source
Characteristics of Lists
Do not have to be
stored
next to each other in
memory
Can contain
elements
of
more than one data type
View source
List Operations
isEmpty
()
append
(value)
remove
(value)
search
(value)
length
()
index
(value)
insert
(position, value)
pop
()
pop
(position)
View source
A
tuple
is an ordered
set
of values of any
type
View source
Tuple
Immutable
,
cannot
be
changed
once
created
View source
Tuples
are initialised using regular
brackets
instead of square
brackets
View source
Elements in a tuple
cannot
be changed or
removed
View source
Linked Lists
are
dynamic data structures
used to hold an
ordered sequence
View source
Linked List
Items do not have to be in
contiguous
data locations
Each item is called a
node
and contains a
data field
alongside a
link
or
pointer
field
View source
When
traversing
a linked list, the algorithm outputs the values at each
node
until it finds that the
pointer
field is
empty
or
null
View source
Manipulating a linked list allows values to be easily
added
or
removed
by
editing pointers
View source
Linked list update
Update the ‘NextFree’ pointer
View source
Linked list update steps
Update the
pointer
field of
'Example'
to point to
'OCR'
at position
3
Update the
pointer
field of
'OCR'
to point to
'Linked'
at position
0
View source
Traversing the linked list
'Example'
,
'OCR'
,
'Linked'
,
'List'
View source
Removing a node from a linked list
Update the
pointer
field of
'Example'
to point to
'List'
at index
2
View source
Traversing the updated linked list
'Example'
,
'List'
View source
Removing a node from a linked list only
ignores
it, which wastes
memory
View source
Storing
pointers
in linked lists requires more
memory
compared to an
array
View source
Items in linked lists are stored
in
a
sequence
and can only be
traversed
in
order
View source
Graphs are a set of
vertices
/
nodes
connected by
edges
/
arcs
View source
Categories of graphs
Directed
Graph
Undirected
Graph
Weighted
Graph
View source
Computers process graphs using an adjacency
matrix
or an adjacency
list
View source
Adjacency Matrix Advantages
Convenient
to work with due to
quicker access times
Easy
to add
nodes
View source
Adjacency List Advantages
More
space efficient
for
large
,
sparse
networks
View source
A stack is a
last in first out
(LIFO) data structure
View source
Stacks
are used to
reverse
actions and are
key
data structures in computer science
View source
Stacks can be implemented as either
static
or
dynamic
structures
View source
Stacks
are implemented using a
pointer
pointing to the
top
of the stack
View source
Manipulating a stack
Performing
operations
on a stack using
specific syntax
View source
Stack Operations
isEmpty
()
push(
value
)
peek
()
pop
()
size
()
View source
Stack
First checks the
stack
is not
empty
by looking at value of
top
pointer
View source
See all 71 cards