Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Prefix codes.

Sequence is a set whose elements are arranged in order as the first element, second element
and so on. The number of elements contained in a sequence is called its length.

A sequence consisting of 1 and 0’s is called binary sequence or binary string.

Ex: 01,010,100,1001,10001 are binary sequences with lengths 2,3,3,4,5.

Binary sequences are used as codes for messages sent through transmitting channels.

Consider a message with letters a,e,n,r,t is to be transmitted. The code would be

a:1, e:0, n:10, r:01,t:


.
101

Using this code if the message eat is to be transmitted. The coded form of message is given by
binary sequence 01101. But this binary sequence cannot be decoded correctly because
sequence 01101 can be decoded not only as eat but also rot, rar,eaar.

Alternatively,if we use the following code:

a:10, e:0, n:1101, r: 111,t:1100

Then message eat is to be transmitted as binary sequence 0101100. It yields only eat and no
other message.

Here code 1 is assigned to a, code10 to n and code101 to t and code assigned to t contains the
code assigned to a and n as prefixes. This arises ambiguity while decoding. In the second
coding scheme the code of any letter is not a prefix of the code of any letter that’s why there is
no ambiguity in decoding.

You might also like