Home
Explore
Exams
Search for anything
Login
Get started
Home
Engineering
Computer Science
1.4 Data types, structures and algorithms
5.0
(1)
Rate it
Learn
Practice Test
Spaced Repetition
Match
Flashcards
Card Sorting
1/145
Earn XP
Description and Tags
Computer Science
Add tags
Study Analytics
All
Learn
Practice Test
Matching
Spaced Repetition
Name
Mastery
Learn
Test
Matching
Spaced
No study sessions yet.
146 Terms
View all (146)
Star these 146
1
New cards
Importance of using the correct data type
Allows the right operations to be performed on it
2
New cards
Character
Single symbol
3
New cards
String
Collection of characters
4
New cards
Real/floating point
Number which can have a decimal part
5
New cards
Binary
2 digit number system
6
New cards
Fractions in binary
Represented by 1/2^x where x increases towards the right in the binary table
7
New cards
Most significant bit/leading bit
First binary digit
8
New cards
Sign magnitude
Uses an extra binary digit to add a +ve or -ve sign in front of the binary number
9
New cards
Sign magnitude - negative
1 as the leading bit (at the start)
10
New cards
Sign magnitude - positive
0 as the leading bit (at the start)
11
New cards
Two’s complement
Makes the most significant bit negative in the binary table
12
New cards
Hexadecimal
16 digit number system, base 16, uses 0-9 and A-F
13
New cards
Binary - hexadecimal
4 bits in binary is equivalent to one place of hex
14
New cards
Floating point binary- sections
Mantissa and exponent
15
New cards
Mantissa
Number
16
New cards
Exponent
Power, number of places the floating point is moved
17
New cards
To practise: subtraction, floating point arithmetic
Examples on physics and maths tutor
18
New cards
Floating point binary - accuracy
Larger values are less accurate
19
New cards
Floating point binary - normalisation
Starts 01 for a positive number or 10 for a negative number
20
New cards
Normalisation - advantage
Makes numbers as precise as possible in the given number of bits
21
New cards
Logical shift
Shift performed on binary numbers, moves all digits a set number of places to the right/left
22
New cards
Effect of logical shift
Division or multiplication by 2^shift number
23
New cards
Carry bit
Can hold 1 binary digit which is lost due to a shift
24
New cards
Mask
Applied to binary by combining with a logic gate
25
New cards
XOR
Exclusive OR, both on or both off=0
26
New cards
Bitewise manipulation
Logical shifts and mask
27
New cards
Character set
Collection of characters and corresponding codes which can be used by computers to represent text
28
New cards
ASCII
Uses 7/8 bits and can represent 128 characters
29
New cards
ASCII - advantage
Uses fewer bits so each character takes less memory to store
30
New cards
ASCII - disadvantage
Fewer characters can be represented
31
New cards
Unicode
Uses a varying number of bits so over a million characters can be represented
32
New cards
Unicode - advantage
Many more characters can be represented
33
New cards
Unicode - disadvantage
Uses more bits so each character requires more memory to be stored
34
New cards
Data structure
Specialised format for processing, storing and retrieving data, collection of different kinds of data
35
New cards
Static data structures
Fixed size during run-time
36
New cards
Dynamic data structures
Can change size during run-time
37
New cards
Array
Static, ordered, finite set of elements of a single type, 0-indexed, values stored contiguously
38
New cards
Data type
The form of a variable to which a value can be assigned
39
New cards
2D arrays
Like a table, use \[y,x\]
40
New cards
3D arrays
Like a spreadsheet with many sheets, use \[z,y,x\] with z as the array number
41
New cards
Record
Like a row in a file, made up of fields - each field can have a different data type
42
New cards
List
Dynamic data structure, values stored non-contiguously (do not have to be stored next to each other in memory)
43
New cards
List - data types
Can contain elements of more than one data type
44
New cards
Tuples
Static ordered set of values, immutable, initialised using normal brackets
45
New cards
Immutable definition
Elements cannot be added or removed once the structure has been created
46
New cards
Contiguous
Data stored consecutively together in memory
47
New cards
Linked-list
Dynamic data structure used to hold an ordered sequence of items (nodes)
48
New cards
Linked-list - advantage
Items do not have to be stored contiguously, dynamic so it can change size
49
New cards
Linked-list - disadvantage
No direct access to a single piece of data so slow to search, pointers must also be stored
50
New cards
Linked-list - items
Nodes, contains a data field and a link/pointer field
51
New cards
Linked-list - pointer
Holds the address of the next item
52
New cards
Linked-list - data stored
Index, data, pointer as well as start pointer and next available location for data
53
New cards
Linked-list - editing
Edit pointers to point to a new item or miss out an existing item
54
New cards
Linked-list - editing: advantage
Easy to edit
55
New cards
Linked-list - editing: disadvantage
Node is not removed but simply ignored, which wastes memory
56
New cards
Graph
Set of vertices/nodes connected by edges/arcs
57
New cards
Directed graph
Edges can only be traversed in one direction
58
New cards
Undirected graph
Edges can be traversed in both directions
59
New cards
Weighted graph
Weight (numerical value) attached to each edge
60
New cards
Graph - representation
Computers use an adjacency matrix or an adjacency list
61
New cards
Adjacency matrix - advantage
Quicker access times than adjacency list
62
New cards
Adjacency list - advantage
More space efficient for large, sparse networks
63
New cards
Stack
LIFO (last in first out) data structure, either static or dynamic
64
New cards
Stack - LIFO
Items can only be added to/removed from the top of the stack
65
New cards
Stack - use
To reverse an action e.g. go back a page in web browsers, undo buttons
66
New cards
Stack - static
Preferred when maximum size of the stack is known in advance, easier to implement and make more efficient use of memory
67
New cards
Stack - implementation
Uses a pointer that points to the top of the stack, where the next piece of data will be inserted
68
New cards
Stack - function
stackName.function(parameters)
69
New cards
Stack - check if empty
.isEmpty() - must be done before peeking or popping, returns Boolean value and works by checking the value of the top pointer
70
New cards
Stack - add a new value
.push(value)
71
New cards
Stack - return top value of stack
.peek()
72
New cards
Stack - remove and return top value of stack
.pop()
73
New cards
Stack - return size
.size()
74
New cards
Stack - check if full
.isFull() - returns Boolean value, works by comparing stack size to top pointer
75
New cards
Queue
FIFO (first in first out) data structure
76
New cards
Queue - FIFO
Items are added to the end of the queue and removed from the front of the queue
77
New cards
Queue - uses
Printers, keyboards, simulators
78
New cards
Linear queue
Data structure consisting of an array
79
New cards
Linear queue - items
Items added into the next available space and removed from the front of the queue
80
New cards
Linear queue - pointers
Two pointers, one pointing to each end of the queue, where items can be added/removed
81
New cards
Linear queue - advantage
Easy to implement
82
New cards
Linear queue - disadvantage
As the queue removes items, there are addresses that cannot be used again, making it ineffective
83
New cards
Queue - functions
queueName.function(parameters)
84
New cards
Queue - add item
.enQueue(item) - increments back pointer
85
New cards
Queue - remove item
.deQueue() - increments front pointer
86
New cards
Queue - checks if empty
.isEmpty() - works by comparing front and back pointer
87
New cards
Queue - checks if full
.isFull() - works by comparing back pointer and queue size
88
New cards
Circular queue - description
FIFO, operates similarly to a linear queue
89
New cards
Circular queue - pointer usage
Once back pointer is equal to maximum size of queue, it can loop back to the front and store values there if the space is empty
90
New cards
Circular queue - advantage
More space efficient than linear
91
New cards
Circular queue - disadvantage
Harder to implement than linear
92
New cards
Tree
Connected form of graph
93
New cards
Tree - root node
Top node, has no incoming edges
94
New cards
Tree - node
Item in tree
95
New cards
Tree - edge/branch/arc
Connects two nodes
96
New cards
Tree - child
Node with incoming edges
97
New cards
Tree - parent
Node with outgoing edges
98
New cards
Tree - subtree
Subsection of tree consisting of a parent and all the children of that parent
99
New cards
Tree - leaf
Node with no children
100
New cards
Binary tree
Type of tree where each node has a maximum of two children
Load more
Explore top notes
Chapter 22
Updated 182d ago
Note
Preview
Chapter Nine: Suicide
Updated 706d ago
Note
Preview
Linear Functions
Updated 1024d ago
Note
Preview
Theories of Personality: Gordon Allport
Updated 907d ago
Note
Preview
Chapter 5 - The Rise and Fall of Business
Updated 766d ago
Note
Preview
Chapter 9: Lifespan Development
Updated 917d ago
Note
Preview
Stem cells- An introduction
Updated 985d ago
Note
Preview
Kinematics Formulas to Know for AP Physics 1 (AP)
Updated 117d ago
Note
Preview
Explore top flashcards
Module 4: Part 1
Updated 553d ago
Flashcards (29)
Preview
HIBE PRACTICAL
Updated 672d ago
Flashcards (21)
Preview
quiz 4
Updated 378d ago
Flashcards (40)
Preview
Biomolecules + Animal Cell Structure and Function
Updated 177d ago
Flashcards (60)
Preview
Spanish 3 vocab part a
Updated 167d ago
Flashcards (51)
Preview
top 150ish
Updated 342d ago
Flashcards (669)
Preview
PORTALES Chapter 11 Vocab
Updated 765d ago
Flashcards (90)
Preview
ENT 104 Midterm 1
Updated 341d ago
Flashcards (199)
Preview