1.4 Data Types, Data Structures and Algorithms Flashcards
What does AND (∧) mean?
A logical operator which returns TRUE (or 1) if and only when all inputs are TRUE (or 1)
What is ASCII?
A character set used to represent alphanumeric characters or symbols as a set of 8 bits
1 check bit and 7 bits for the number
What is binary?
A number system that only uses 1s and 0s to represent numbers (a base 2 system)
What is bitwise manipulation?
Operations perfomed on a set of bits
What is boolean?
A data type that can only store one of two possible values (1 or 0, TRUE or FALSE, etc.)
What is a character?
A data type for storing one letter, number or special character
What is Denary?
A number system that only uses 10 characters (0 to 9) to represent numbers (a base 10 system)
What are the 5 data types?
Character
Boolean
String
Integer
Real/Float
What is Floating Point Arithmetic?
Performing arithmetic operations on floating point numbers in binary
What is Hexadecimal?
A number system that only uses 16 characters (
0 to 9 and A to F) to represent the numbers (a base 16 system)
What is an integer?
A data type for storing whole numbers with no decimals, positive or negative
What does OR (V) mean?
A logical operator which returns TRUE (or 1) if and only if any one of the inputs are TRUE (or 1)
What is the primitive data type?
A basic built in data type provided by a programming language
What is a Real/Floating point?
A data type for storing numbers with decimal or fractional parts
What are the binary Shifts?
A bitwise manipulation where a set of bits are all moved by one place in a given direction, and the end bit may be taken as a carry or appended to the other end depending on the shift method
What is the String data type?
Used to store a sequence of alphanumeric characters or symbols, typically within quotation marks
What is Two’s Complement?
A method of storing negative numbers in binary
It involves flipping all the bits of the binary representation of the positive number and then adding 1
What is UNICODE?
A character set that is a superset of ASCII
It is used to represent alphanumeric characters and symbols as an integer code point which is equal to that character’s ASCII code
What does XOR do?
A logical operator which returns TRUE or 1 when only one input is TRUE or 1
What are arrays?
A data structure for storing a finite, ordered set of data of the same data type within a single identifier
What is a Binary Search Tree?
A tree where each node cannot have more then 2 children nodes
The right node and its descendants always have a greater value than the root node (first data item)
What is a Depth First Transversal?
A method of traversing an entire graph by travelling as far as possible along one route before backtracking and trying alternative unexplored routes
What is a Breadth First Transversal?
A method of traversing an entire graph by visiting all the neighbours of the first node before repeating the same with each neighbour in the order they were visited
What is a Directed Graph?
A graph where the order of the vertices paired in an edge matter
The edges are one way
What is a graph?
A data structure consisting of a set of vertices/nodes connected by a set of edges/arcs
What is a Hash Table?
A data structure where a hashing algorithm calculates a value to determine where a data item is to be stored
The data item can then be directly accessed by recalculation, without any search
Uses an algorithm to determine storage location.
What are Linked Lists?
A data structure that stores an ordered sequence of data where each item is stored with a pointer to the next item
The items are not stored contiguously (in this same order) in memory
What are Lists?
A data structure that stores a sequence of data values, each with a unique index
What are Queues?
A first in first out (FIFO) data structure
The first item added/pushed on to the queue is the first to be removed/popped off
What are Stacks?
A last-in-first-out data structure
The last item added/pushed is the first to be removed/popped off
What are Records?
A data structure that stores a collection of fields which store data based on attributescan be did data type
What are Trees?
AA data structure that uses a set of linked nodes to form a hierarchical structure starting at a root node
Each node is a child/sub-node of a parent node
What are Tuples?
A data structure for storing an immutable, ordered set of data, which can be of different data types, within a single identifier
What is an Undirected Graphs?
A graph where the order of the vertices paired in an edge does not matter
Their edges are bidirectional
What are the Association Laws?
A ∧ (B ∧ C) = (A ∧ B) ∧ C
A V (B V C) = (A V B) V C
What are Boolean expressions?
A combination of Boolean values and logical operators which evaluates to either TRUE or FALSE depending on the inputs
What is Boolean Logic?
A type of algebra with logical operators where all the values and expressions ultimately reduce to TRUE or FALSE
What are the Commutation Laws?
A ∧ B = B ∧ A
A V B = B V A
What are the De Morgan’s Laws?
¬(A V B) = ¬A ∧ ¬B
¬(A ∧ B) = ¬A V ¬B
What are the Distribution Laws?
A ∧ (B V C) = (A ∧ B) V (A ∧ C)
(A V B) ∧ (C V D) = (A ∧ C) V (A ∧ D) V (B ∧ C) V (B ∧ D)
What is the Double Negation Law?
¬¬A = A
What are D-Type Flip Flops?
A sequential logic circuit used to store a single bit
It has two stable states, which can be flipped between using an input signal
What are Full Adders?
A combination od two half adders that takes a carry bit and two other input bits and returns their sum and trhe new carry as two output bits
What are Half Adders?
A combinational arithmetic circuit that adds two numbers and produces a sum bit (S) and carry bit (C) as the output
What are Karnaugh Maps
A method of simplifying Boolean expressions by redrawing the truth table and applying a set of visual rules to obtain expressions wit (or close to) the minimum logical operators, as a sum of products
What are Logic Gate Diagrams?
A graphical method of representing Boolean expressions using the standard symbols for logic gates
Why do computers store data in binary?
Easier to process and takes up less space
Binary to decimal?
1101
Write out the binary number under powers of increasing 2…
2^3 2^2 2^1 2^0
1 1 0 1 = 13
8 + 4 + 1 = 13
Decimal to binary?
82
Write out the powers of 2 again, take away the greatest one possible till 0 is acquired.
82 - 64 = 18
18 - 16 = 2
2 - 2 = 0… done.
01010010
Hexadecimal to binary?
B2
Split up the hexadecimal..
B 2
B = 11 2 = 2
11 = 1011 2 = 0010 (convert to binary)
Then combine to make the full conversion = 10110010 = B2
Hexadecimal to decimal?
4C3
Same thing as binary to decimal, line up the hexadecimal number with the columns of increasing powers of 16…
16^2 16^1 16^0
4 C 3
4x256 + 12x16 + 3x1 = 1219
How can you tell if a floating point numbers in binary have been normalised?
They start with either…
01, for a positive number
10, for a negative number
Normalise the binary number 000110100101 which is a floating point number with an eight bit mantissa and a four bit exponent.
Mantissa = 01101000
Exponent = 0011
if you got this wrong check one note and revisit later on…
Why is hexadecimal used to represent data?
More compact so use less memory, so more numbers can be stored in computer systems. More user friendly representation of binary-coded values
Why is decimal used?
Easiest to read and understand for humans
Each binary shift to the left or the right does what affect to the binary number?
Left = Doubling
Right = Halving
What is a mask?
A mask can be applied to binary numbers by combining them withy a logic gate
What happens when you mask the binary numbers below with an AND, OR and XOR gates?
00101011
10111011
AND = 00101011
XOR = 10010000
OR = 10111011
What is a character set?
A published collection of codes and corresponding characters which can be used by computers for representing text
How many different characters could be represented through ASCII?
0-127, so therefore 128