4 + 9. Data Representation and Algorithms Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a bit?

A

A binary digit (a bit) is the fundamental unit of data storage, and will have a value of 0 or 1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a byte?

A

A group of 8 bits.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a word?

A

Word refers to the amount of data that can be handled at one time by the processor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why is hexadecimal used as a shorthand for binary?

A

Long sequences of binary digits are hard to read and understand for humans.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How is text represented?

A

In order to represent text, each individual letter or character must be represented a unique binary pattern. In order to consistently represent characters from many different languages, these patterns must universally understood (through ASCII and Unicode).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How are numbers represented?

A

Numbers are represented using number base systems, which determine which digits are used to represent a number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a character set?

A

Character maps are used to represent each character. Each character is mapped to a binary number. Allows for standardised communication between computer systems

ASCII - Can only represent 128 characters (not sufficient to represent all languages/scripts)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is bubble sort?

A

The bubble sort algorithm works by repeatedly going through a list of items, comparing consecutive pairs of items and swapping the items if they are in the wrong order.

Each time the algorithm goes through the list a pass is complete.

The passes through the list are repeated until the items are sorted.

Bubble sort can be used on an ascending or descending list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an Insertion Sort?

A

The insertion sort algorithm works by building up a sorted sub list in the first part of the original list, while the remaining part of the list remains unsorted.

The algorithm goes through the unsorted sub list, item by item. As each item is examined, it is moved into the correct position (in ascending or descending order) in the sorted sub list. This progresses until the final item is correctly inserted and the list is sorted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is binary search?

A

The algorithm calculates a midpoint and depending on if the list is ascending or descending will ignore a certain half of the list and focus on the half that contains the desired the item. It repeats this process until the item is found.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is linear search?

A

The algorithm for this process is called linear search, because it involves starting from the beginning of the list and checking one item at a time to see if it’s the right one.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Describe appropriate circumstances for the use of binary and linear search?

A
  • Requires input data to be sorted, linear doesn’t.
  • Binary search requires an ordering comparison, linear search only requires an equality comparison
  • Linear search would be slower than binary search on a larger list/
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why do we need to data compress?

A

Data compression is used so large files can be transferred over a cable or wireless communications link easier and faster. Compression algorithms are used to store large files in limited storage, it saves space and money.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is lossy compression?

A

Lossy compression refers to loss of data (data is removed). When the file is decompressed, the data that was removed is re-created from the data that remains in the file. The re-created data will never be an exact copy of the original. Instead, it will be an approximation of the original data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is lossless compression?

A

Lossless compression refers to no data is lost in the compression process. When the file is decompressed, the contents are identical to the original file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is RLE?

A

Run length encoding (RLE) is a lossless compression technique. It works by finding runs of repeated binary patterns and replacing them with a single instance of the pattern and a number that specifies how many times the pattern is repeated

16
Q

What is Dictionary?

A

Dictionary-based compression is another lossless technique that relies on finding patterns in data. Instead of storing the pattern itself, a shorter code is substituted.

17
Q

What is a variable?

A

A variable is a named location in the computer’s memory that a programmer can use to store data whilst the program is still running

18
Q

What is a constant?

A

A constant is similar to a variable in sense it has an identifier and will store a value but the value will not change.

19
Q

What is a self-documenting identifier?

A

An identifier that conveys its purpose without requiring additional comments.

20
Q

What is a parameter (by value)?

A

A local copy of the data is created for the procedure (discarded later)

21
Q

What is parameter by reference?

A

When passing by reference, the address
of the required data is passed to the
procedure. Any changes made within the subroutine will also affect the variable outside.

22
Q

What is parameter?

A

A parameter is a variable that can be passed to/from the procedure

23
Q

What is the pseudocode for a linear search?

A

declare myArray[0 to 999] is integer
searchValue is integer
found is boolean

set found = FALSE

input searchValue

for i = 0 to len(myArray)
if searchValue = myArray[i] then
set found = TRUE
output “SearchValue found at position
end if
next i

if found = FALSE
output “SearchValue not found”
end if

24
Q

What is the pseudocode for a binary search?

A

declare myArray(0 to x) is integer
start is integer
end is integer
found is boolean
mid is integer

set start = 0
set end = len(myArray)
set found = FALSE

input searchValue

repeat
set mid = (start + end) DIV 2

if searchValue = myArray[mid] then
set found = TRUE
output”searchValue found at position”,mid
end if

if searchValue > myArray[mid} then
set start = mid + 1
end if

if searchValue < myArray[mid] then
set start = mid - 1
end if

until (found = TRUE) or (end<start)

25
Q
A