Dictionary Coding

Computer Science: OCR A Level, topic 3.1.3

Dictionary Coding

Dictionary coding is used to store text in a lossless format.

Dictionary coding

Dictionary coding

  • The coder scans through a body of text.
  • Each word is replaced by the binary number of the word in a dictionary.
  • Each time it finds a new word which is not in its dictionary, it will add it to the dictionary and give it a binary number.
  • The word in the actual text is replaced with the binary number.
Benefits of dictionary coding

Benefits of dictionary coding

  • Dictionary coding is a type of compression. It takes less bits to store a 2 digit binary number than we can a 10 letter word.
  • No data is lost, so the coding is lossless.
  • The encoder may not always build its own dictionary. A pre-existing dictionary may be used to encode the text.

Test yourself on Dictionary Coding

  • Which type of data is compressed using dictionary coding?

  • What happens when the dictionary coder finds a word that is not in the dictionary?

Practise this topic for free