Hamming distance: Difference between revisions

Content deleted Content added
m +fr:
Added blue to first examples and emboldened examples to make reading easier
Line 2:
 
For example:
* The Hamming distance between 1011101'''10<font color=blue>1</font>1<font color=blue>1</font>01''' and '''10<font color=red>0</font>1<font color=red>0</font>01''' is 2.
* The Hamming distance between 2143896'''2<font color=blue>14</font>3<font color=blue>8</font>96''' and '''2<font color=red>23</font>3<font color=red>7</font>96''' is 3.
* The Hamming distance between "toned'''<font color=blue>t</font>o<font color=blue>n</font>e<font color=blue>d</font>'''" and "'''<font color=red>r</font>o<font color=red>s</font>e<font color=red>s</font>'''" is 3.
 
The '''Hamming weight''' of a string is its Hamming distance from the zero string (string consisting of all zeros) of the same length. That is, it is the number of elements in the string which are not zero: for a binary string this is just the number of 1's, so for instance the Hamming weight of 11101 is 4.