Dictionary encoding

Dictionary encoding is a method of [[ /lossless compression|lossless compression]] where we replace repeated data with a reference to a single copy of that data, stored in a sort of ‘dictionary’ that maps the reference to the original data.

For example, if we had the string ABCDABCDABCD, we could store that as:

Dictionary:
1: ABCD

Data:
1 1 1

That is, we have a dictionary that maps the reference 1 to the string ABCD, and then in our data, we just store the reference 1 three times to indicate that we want to repeat the string ABCD three times.

Benefits of dictionary encoding

Drawbacks of dictionary encoding