0% found this document useful (0 votes)
1K views9 pages

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

This document discusses uniquely decodable codes (UDC) in data compression. It defines coding as assigning binary sequences (codewords) to symbols. A code is the set of all codewords. UDC means there is only one way to interpret sequences of codewords. The document provides an example procedure to check if a code is UDC by examining for codeword prefixes and adding any dangling suffixes as new codewords, repeating until there are no more unique dangling suffixes. A provided example code {0, 01, 11} is determined to be UDC as this process results in no new codewords being added.

Uploaded by

Pooja Bharti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views9 pages

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

This document discusses uniquely decodable codes (UDC) in data compression. It defines coding as assigning binary sequences (codewords) to symbols. A code is the set of all codewords. UDC means there is only one way to interpret sequences of codewords. The document provides an example procedure to check if a code is UDC by examining for codeword prefixes and adding any dangling suffixes as new codewords, repeating until there are no more unique dangling suffixes. A provided example code {0, 01, 11} is determined to be UDC as this process results in no new codewords being added.

Uploaded by

Pooja Bharti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

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