The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+8 votes

Following 7 bit single error correcting hamming coded message is received.

Determine if the message is correct (assuming that at most 1 bit could be corrupted). If the message contains an error find the bit which is erroneous and gives correct message.

+7 votes

Best answer

Here Answer is yes. There is error in This message. Error is in bit 6.

How to calculate it ? First of all reverse given input to get it in correct position from 1 to 7.

0110001

Bit 1, Bit 2 & Bit 4 are partity bits.

Calculating position of error =>

c3 c2 c1

1 1 0

Here c1 = bit4⊕bit5⊕bit6⊕bit7=0⊕0⊕0⊕1=1 (Taking Even parity )

c2 = bit2⊕bit3⊕bit6⊕bit7=1⊕1⊕0⊕1=1

c3 = bit1⊕bit3⊕bit5⊕bit7=0⊕1⊕0⊕1=0

Ref -> https://en.wikipedia.org/wiki/Hamming%287,4%29

When you correct bit 6 .

You get message as 0110011.

IF you calculate C1,c2,c3 all will be 0 now !

See example here..

good read if u want to grasp it completely.

+1 vote

6th bit is having error both parity bit 2 and 4 support this so 6 bit need to be 1 and data must be 1100110

0 votes

Answer: Bit 5 has the error. It should be 1.

Here, parity bits are 1,2,4 (power of 2).

Hamming code based on data bits received = 110

Bit 1 = Bit 3 $\oplus$ Bit 5 = 1 $\oplus$ 0 = 1. (XOR of all bits having the least significant digit as 1)

Bit 2 = Bit 3 $\oplus$ Bit 6 = 1 $\oplus$ 0 = 1. (XOR of all bits having the second least significant digit as 1)

Bit 7 = Bit 4 $\oplus$ Bit 5 $\oplus$ Bit 6 = 0 $\oplus$ 0 $\oplus$ 0 = 0. (XOR of all bits having the third least significant digit as 1)

But the received message has Bit 1 = 0, Bit 2 = 1, Bit 7 = 1 (Actual hamming code)

Bit error = Hamming code based on data bits received $\oplus$ Actual hamming code = 110 $\oplus$ 011 = 101 (i.e. Bit 5 has the error)

Here, parity bits are 1,2,4 (power of 2).

Hamming code based on data bits received = 110

Bit 1 = Bit 3 $\oplus$ Bit 5 = 1 $\oplus$ 0 = 1. (XOR of all bits having the least significant digit as 1)

Bit 2 = Bit 3 $\oplus$ Bit 6 = 1 $\oplus$ 0 = 1. (XOR of all bits having the second least significant digit as 1)

Bit 7 = Bit 4 $\oplus$ Bit 5 $\oplus$ Bit 6 = 0 $\oplus$ 0 $\oplus$ 0 = 0. (XOR of all bits having the third least significant digit as 1)

But the received message has Bit 1 = 0, Bit 2 = 1, Bit 7 = 1 (Actual hamming code)

Bit error = Hamming code based on data bits received $\oplus$ Actual hamming code = 110 $\oplus$ 011 = 101 (i.e. Bit 5 has the error)

the answer is wrong.it should be bit 6.if you consider forouzan's book of data networking, the answer should be bit 6.then the correct message will be 1100110.

her the parity bits are bit 1,bit 2, bit 4.

now to calculate bit 1=bit1⊕bit3⊕bit5⊕bit7=0⊕1⊕0⊕1=0

again,to calculate bit 2=bit2⊕bit3⊕bit6⊕bit7=1⊕1⊕0⊕1=1

again,to calculate bit 3=bit4⊕bit5⊕bit6⊕bit7=0⊕0⊕0⊕1=1

therefore ,the error is at the position 110 = 6

please ,think of it mr @jon_snow.

- All categories
- General Aptitude 1.1k
- Engineering Mathematics 4k
- Digital Logic 1.7k
- Programming & DS 3k
- Algorithms 2.6k
- Theory of Computation 3.2k
- Compiler Design 1.2k
- Databases 2.4k
- CO & Architecture 2.1k
- Computer Networks 2.4k
- Non GATE 819
- Others 1.1k
- Admissions 244
- Exam Queries 420
- Tier 1 Placement Questions 16
- Job Queries 39
- Projects 4

29,158 questions

36,985 answers

92,166 comments

34,824 users