Hamming Code Issue

Back to General discussions forum

jpchavesm     2021-02-24 02:31:55

The problem statement goes like this: "The second part on contrary gives you a handful of bit strings with Hamming's parity bits - and each of the strings may contain error in a single bit. You are to decode them." However the example answer gives off binary numbers that are outside of the lenghts of any example test strings. I thought you were simply supposed to run those 2nd-part strings through a check and output the binary representation of the guilty bit, but clearly I'm missing something here. Am I supposed to add parity bits too or something?

Rodion (admin)     2021-02-24 06:40:21
User avatar

Hi Friend!

I thought you were simply supposed to run those 2nd-part strings through a check and output the binary representation of the guilty bit

despite I don't clearly remember this :) seemingly you need to reconstruct the input sequence, i.e. without hamming bits and with error bit (if any) corrected.

Thus value 110111111 consists of 9 bits. Regarding hamming bits positions we understand that input was of 5 bits and 4 hamming bits were added. So the answer should be 5 bits, __0_111_1 (in this case there was no error, as I understand, so it is compacted to 01111).

Does it clarify the matter a bit?

jpchavesm     2021-02-24 22:26:23

Hello Mr. Gorkovenko Yes that was it, got it right this time Thanks!

kostis_k     2021-03-21 20:25:08
User avatar

Since this thread was open, i didn't see the point in opening a new one for a simple remark.

Regarding the second part of the problem, the parity checking that is, it is stated that the position of the bit with the error comes up as the result of successive XOR operations on the groups of positions that correspond to each parity bit (which as cleverly stated comes up by a bitwise AND operation). However, before reading the problem statement I had watched a two part video by 3Blue1Brown on Hamming Codes where he states that the error position simply comes up as the result of a single bitwise XOR operation on all the positions that have a value of 1. And it's true! It makes for a somewhat simpler code.

Perhaps Rodion would like to add it as a remark to the problem statement. I thought it was worth mentioning. Cheers!

Rodion (admin)     2021-03-23 11:09:29
User avatar

Kostis, Hi!

Really, this becomes obvious (or close to this) after some consideration - but not that obvious until you told :)

Thanks a lot - added this to problem statement, as suggested!

Please login and solve 5 problems to be able to post at forum