Golomb examples:-
Construct the Golomb codes for the following numbers using the indicated value of b: (28, b = 2), (203, b = 32).
Gamma codes*:-
Let x be a positive integer. The γ code for x consists of a unary code for 1 + log x followed by the binary code for x - 2log x.
Essentially, the first part of the γ code tells how many bits are required to code x in binary, and the second part is the binary code for x with all bits preceding the second 1 omitted. For example, the γ code for 13 is 1110 followed by 101, indicating the binary code 1101 of length 4.
(a) Find the γ code for 20.
(b) The length of the gamma code is approximately 1+2 log x bits.
Find the probability distribution of x that would make the γ code the one minimizing average length.