Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M4571

Hamming Distance

Hamming Distance
Learn & MetacognitionHigh supportCognitive Science
Included
account_tree

Updated 2026-07-28

Loading revision record…

Summary

In information theory, the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number of substitutions required to change one string into the other. The Hamming weight is the Hamming distance between a string and the zero string of the same length, that is, the number of non-zero elements in the string: for binary strings, it is the number of 1s, so the Hamming weight of 11101 is 4.

Definition

In information theory, the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number of substitutions required to change one string into the other. The Hamming weight is the Hamming distance between a string and the zero string of the same length, that is, the number of non-zero elements in the string: for binary strings, it is the number of 1s, so the Hamming weight of 11101 is 4.

How to use

In information theory, the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number of substitutions required to change one string into the other. The Hamming weight is the Hamming distance between a string and the zero string of the same length, that is, the number of non-zero elements in the string: for binary strings, it is the number of 1s, so the Hamming weight of 11101 is 4.

Mechanism

For two strings of equal length, count the number of positions where they differ; this count is the distance. A code with minimum distance d can detect up to d-1 errors and correct up to floor((d-1)/2) errors. It quantifies "difference" as the minimum number of flips required, forming the geometric basis for error-correcting code design.

Practice

In progress 0/1

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

Cases

  • "1011101" and "1001001" have a distance of 2; in communication, choose codewords with large distances to resist interference; when comparing two theories, count the number of fundamental propositions that contradict each other.

Common pitfalls

  • Only applicable to strings of equal length; direct comparison of unequal lengths or without alignment can be misleading; or confusing it with "edit distance" (which allows insertions and deletions).
Sources

Source support: Explicit

References currently contain only Wikipedia links; primary sources still need review.

  • link
    zh.wikipedia.orghttps://zh.wikipedia.org/wiki/%E6%B1%89%E6%98%8E%E8%B7%9D%E7%A6%BBZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS