Uniquely Decodable Codes (UDC) : Data Compression and Data Retrieval

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9
At a glance
Powered by AI
The key takeaways are that coding is the process of assigning binary sequences to an alphabet, and there are two main types of coding: fixed length coding and instantaneous coding. A uniquely decodable code is one that has only one way to interpret the sequences and codewords, with characteristics like prefixes and dangling suffixes.

The two types of coding discussed are fixed length coding, where the bits per symbol is calculated as the log base 2 of the number of symbols, and instantaneous coding.

For a code to be uniquely decodable, there should be only one way to interpret the sequences and codewords, with no prefixes of one codeword in another codeword, which would create a dangling suffix.

Uniquely Decodable

Codes (UDC)
Data Compression and Data Retrieval
What is coding?
• Coding is the process of assigning binary sequences to an alphabet.
Messages Codewords
a1 0000
a2 0001
a3 0010
a4 0011

• Code: The set of all codewords is called a code.


• Rate: The average number of bits per symbol is called the rate.
Cont…
• Two types of coding:
1) Fixed length coding
2) Instantaneous coding

• For fixed length coding:


Bits per symbol B = log2N, where N is number of symbols
Uniquely Decodable Codes (UDC)
• Uniquely Decodable code is nothing but that is there should be only
one way of interpreting the sequences with their associated
codewords.
• Prefix: If the beginning subsequence of codeword b is equal to
codeword a, then a is a prefix.
• Dangling Suffix: If a is a prefix of b, then the subsequence of b
excluding the prefix a is called a dangling suffix.
Cont…
a b
K bits N bits
• a and b are two codewords and K < N
• If first K bits of b are identical to a, then a is a prefix of b.
• Remaining (N-K) bits of b is called dangling suffix.

• Example: a=010 and b=01011


a is prefix of b and dangling suffix is 11.
Procedure
• Examine if any codeword is a prefix of another codword, if so, add the
dangling suffix to the code as a codeword. Repeat the procedure until:
(1) We get a dangling suffix that is a codeword.
(2) There are no more unique dangling suffixes.
• If we get (1), the code is not uniquely decodable.
Cont…
• Example: {0, 10, 01}
• See 0 and 10. 0 is prefix of 01 so we get dangling suffix as 1.
• Add this 1 to the code and the revised code is {0, 10, 01, 1}.
• Now check for 0 and 01. Dangling suffix is 1, which is already added to
the code.
• Now check for 1 and 10. 0 is dangling suffix and 0 is already there in
the original code.
• So this code is not uniquely decodable.
Cont…
• Example: {0, 01, 11}
• Check for 0 and 01. Dangling suffix is 1.
• This 1 is added to the code and revised code is {0, 01, 11, 1}.
• Now check for 0 and 01. Dangling suffix is 1 but it is already added.
• Now check for 1 and 11. Dangling suffix is 1 but it is already added.
• Now there are no more dangling suffixes in this code. So this code is
uniquely decodable.
Thank
You

You might also like