Length Size

Is it possible to compute Hamming Distance if length size is diff?

Is it possible to compute Hamming Distance if length size of a word / string / code / is different? For example, as we know, the hamming distance of 0110 and 1001 can easily be computed.

But what if the numbers are, 10100101 and 1001?
or the words are cool and happy?

Is it possible? And if yes, how do we get it?

According to Wikipedia, the lengths have to be the same:

http://en.wikipedia.org/wiki/Hamming_distance

If I really, truly had to compute the HD of two strings of possibly unequal length, I would calculate the HD of the shortest string with the first strlen( shortest string ) characters of the longest string, and then add strlen( longest string ) - strlen( shortest string ) to it. This would simulate that they are of equal length, but the last characters of the longest string are all considered to be different.

But that would, by definition, not be an actual HD anymore.

No items matching your keywords were found.


Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!