Hashing Flashcards

1
Q

Define ‘lossy compression’

A

Compression where non-essential data is removed to free up space, for example:

Different shades of the same colour in an image
Frequencies of sound outside the human hearing range

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

Define ‘lossless compression’

A

Compression where the computer analyses patterns in the data, and summarises it in a shorter format - without removing any information.

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

How does lossy compression work in images?

A

Different shades of certain colours are removed
Picture is reconstructed with less coloured pixels

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

How does lossy compression occur in sounds?

A

Sounds with frequencies outside the range of human hearing are removed from the file
Quieter notes playing at the same time as louder notes are also removed from the file

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

What is the difference between lossy and lossless types?

A

Lossy: Is most effective at reducing file size

Lossless: Maintains the information of the original data

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

What is lossy compression typically used for?

A

Audio files and pictures

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

State the effect of using lossy compression on pictures and audio

A

Pictures files: Would lose their original resolution, as there are less individual colours to make up the picture

Sound files: Would lose their sharpness

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

State one method of lossless compression and where it is used

A

Run Length Encoding: Used in pictures and sound files.

Dictionary Compression: Used in word files

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

Explain how Dictionary Compression works:

A

Repeating words / characters are added to a dictionary, and assigned a [shorter] binary value

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

Explain what state a data set must be in in order to use binary search

A

Data must be sorted in either ascending or descending order

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

What is a hashing table?

A

A data structure which will find any record in a dataset instantly

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

What is hashing?

A

Organising large data sets so each record has its own unique address

Records are organised via hashing algorithms/hash functions

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

Define ‘collision’

A

When an algorithm generates the same address for primary keys

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

State the simplest method for dealing with collisions

A

Putting the item in the next free slot in the table

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

State one alternative method for dealing with collisions

A

Incrementing the ‘skip’ value by adding another number to find a free space

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

Define ‘load factor’

A

Measure of how full up the table is

17
Q

What is the ideal load factor of a hashing table?

A

No more than 50%-70%

18
Q

State two other hashing algorithms

A
  • The ‘mid-square’
  • The ‘folding method’
19
Q

Explain how the ‘mid-square’ hashing algorithm works

A
  • Square the number
  • Extract digits
  • Perform the mod (remainder) function to get an address
20
Q

Explain how the ‘folding’ hashing algorithm works

A
  • Divide the item into equal-size pieces
  • Add the pieces together
  • Perform the mod (remainder) function to get an address
21
Q

How can we hash alphanumeric data?

A

Convert each character to its ASCII code, then applying a hashing algorithm

22
Q

What must happen if an item is to be deleted

A

Items to be deleted must be replaced with a dummy item/marker, e.g. the word ‘Deleted’