Lecture 4 - LZW Compression Flashcards

1
Q

What based method is this?

A

Dictionary based

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

What is a dictionary

A

A collection of strings, with each string having a dedicated codeword to represent it. The codeword is a bit pattern, that can be represented by an unsigned int.

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

What is written to the compressed file?

A

The bit pattern (codeword). The bit pattern can differ for different chars, as the length changes during runtime of the algorithm.

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

Is dictionary statically available?

A

No it is built dynamically during both compression and decompression.

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

What does the dictionary intially contain?

A

All possible strings of length 1.

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

What is ‘closed under prefix’?

A

all prefixes of current string s are reprsented

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

What is the optimal representation of the dictionary?

A

A trie due to the closed under prefix property.

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

How many more strings can we store in the dicionary if the available codeword length increases by 1.

A

The size doubles

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

The 3 LZW Variants:

A

Constant codeword length: fix the codeword length for all time
-> the dictionary has fixed capacity: when full, just stop adding to it

Dynamic codeword length (the version we have been taught)

LRU version: when dictionary full and codeword length maximal
-> current string replaces Least Recently Used string in dictionary

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

Does the decompression stage build the same dictionary as the compression stage?

A

Yes, but one step out of phase.

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

Complexity of compression and decompression?

A

O(n) , as we pass through the text once and populate dictionary at every iteration

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