In: Computer Science
Solution:
Perfect hamming code:
A hamming code is said to be perfect if it follows equality rule.That is satisfy hamming bound with equality
Where r is priority or redundant bit and m is data bit
.hamming code bit =m+r
Now hamming for
That is data is 11 bit and hamming code bit is 15
now for above inequality relation it holds for r=4 and it satisfy hamming bound with equality
that's why hamming (15,11) considered a perfect code.
Part2:
The format for a (15,11) code word, p1,p2, p3 p4 are the parity bits and d1 to d11 are rhe data bits.
Here since the hamming code is of 15 bit and data bit is 11 bit and total number of parity bit is 4 (r=4)
it satisfy hamming bound with equality.
for r=4.
So parity bit will be
Here having least bit in binary is 1,
having second bit in binary representation is 1 from least significant bit
While calculating p3 it contains number having 3rd bit 1 most from least significant bit..
and having 4rth bit is 1 from least significant bit.
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
d11 | d10 | d9 | d8 | d7 | d6 | d5 | P4 | d4 | d3 | d2 | P3 | d1 | P2 | P1 |
For Example the data bit 11001001010 can be represented as
1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | |||
d11 | d10 | d9 | d8 | d7 | d6 | d5 | P4 | d4 | d3 | d2 | P3 | d1 | P2 | P1 |
On the basis of parity either Even or odd we can find parity values
of P1,P2,P3,P4
Types of parity
1.Even Parity:
To be in even parity ,the total number of 1's corresponding to data should be even number
for Example if total number of 1's for particular data for calculation of P1 is if odd (e.g 3) then the value of p1 should be 1 otherwise 0.
2. Odd Parity:
in the odd parity total number of data values corresponding to d1 .... d11 for finding parity should be odd
That is in odd parity,for given set of data bit , 1 is counted and if it is odd then parity value set to 0 ,if it is even then parity value set be 1.
part3.
Answer
Hamming code:
Hamming code is a block of code represented in binary form that is capable of detecting two simultaneos bit errors and correcting single bit errors.
In this method ,
the source encoded the massege by inserting redundant bits within the massege and specify about bit parity either
even or odd parity .
For example if a receiver receive massege of data as 1011011 and sender specify that it is with even parity
then simply format into table as above and specify all parity and after that calculate parity values for individual if given parity values is same as found through calculation then that will be right other wise that will be wrong.
7 | 6 | 5 | 4 | 3 | 2 | 1 |
1 | 0 | 1 | 1 | 0 | 1 | 1 |
d7 | d6 | d5 | p4 | d3 | p2 | p1 |
Now to check p1
P1->(3,5,7) and correspondng bit values (0,1,1) so total number of 1 is 2 and it is given that even parity
so P1 values is wrong ,it should be 0
p2->(2,3,6,7) and corresponding values (P2, 0,0,1) total 1's is only 1 that is odd so,
set value of P2 equal to 1 and also given 1 ,so it is right.
p4->(4,5,6,7) ->(p3,1,0,1) so total number of 1's is 2 that is already in even parity so set value of p4 = 0
but given p4 values is 1 that wrong,
hence received massege is not correct.
Now we can correct by fixing any one of them only either p1 or p4.
hence hamming code can detect at most 2 bit but only can correct 1 bit that is single bit.