NGHỆ THUẬT
LÀM ĐẸP VÀ SỨC KHỎE
THỦ CÔNG
VĂN HÓA VÀ LỊCH SỬ
GIẢI TRÍ
MÔI TRƯỜNG
THỰC PHẨM VÀ ĐỒ UỐNG
KỸ THUẬT NGƯỢC
KHOA HỌC
THỂ THAO
CÔNG NGHỆ
THIẾT BỊ ĐEO
Hamming Code
Mark

Tạo bởi

Mark

20. tháng Tám 2026FI
0
0
0
0
0

Hamming Code

A parity bit tells you that something is wrong. A Hamming code tells you exactly which bit is wrong, so you can flip it back. The trick is to use several parity bits, each checking a different overlapping subset of the data, chosen so that every possible single-bit error produces a unique pattern of failed checks — and that pattern, read as a binary number, is the position of the broken bit. Richard Hamming devised it at Bell Labs around 1950 out of ordinary frustration: he ran jobs on a relay machine over the weekend, the machine detected parity errors, gave up, and dropped the job, so he came back on Monday to nothing. His question was why a machine that could detect an error could not simply fix it.
Trung cấp
1 hour

Hướng dẫn

1

Place the parity bits at the powers of two

Positions 1, 2, 4 and 8 are reserved; everything else carries data.

  1. Number seven positions 1 to 7.
  2. Mark positions 1, 2 and 4 as parity; 3, 5, 6 and 7 hold four data bits.
  3. Write your four data bits into their positions.
The powers of two are chosen because each has exactly one 1 in its binary representation — which is what lets each parity bit own one binary digit of the answer. The placement is doing the arithmetic.

Vật liệu cho bước này:

Graph PaperGraph Paper1 pad
Graphite Pencil SetGraphite Pencil Set1 bộ
2

Work out which bits each check covers

Each parity bit covers every position whose number contains its bit.

  1. P1 covers positions 1, 3, 5, 7 — those with a 1 in the ones place.
  2. P2 covers 2, 3, 6, 7 — a 1 in the twos place.
  3. P4 covers 4, 5, 6, 7 — a 1 in the fours place.
  4. Set each parity bit to make its own group even.
Write the position numbers in binary beside the list and the pattern is obvious. The overlapping groups are not arbitrary — they are the binary expansion of the position numbers, laid out as sets.

Vật liệu cho bước này:

Cardstock Assorted Pack (50 Sheets)Cardstock Assorted Pack (50 Sheets)1 gói
3

Corrupt a bit and locate it

The correction, performed by arithmetic rather than by searching.

  1. Hand your seven-bit block to someone; have them flip one bit secretly.
  2. Check each parity group and write 1 for a failed group, 0 for a passed one.
  3. Read those results as a binary number: P4 P2 P1.
  4. That number is the position of the broken bit. Flip it back.
If groups 1 and 4 fail but 2 passes, the number is 101 — position 5. Notice the parity bits check themselves too, so an error in a parity bit is located just as cleanly. All zeros means no error detected.
4

Measure the cost and find the boundary

Every code pays for its capability, and every code has a limit.

  1. Count the overhead here: 3 parity bits for 4 data bits.
  2. Work out the overhead for 11 data bits — it needs only 4 parity bits.
  3. Now flip TWO bits and run the location procedure.
Overhead falls sharply as blocks get longer, which is why real codes use large blocks. And with two errors the syndrome points confidently at a third, innocent bit — so the code makes things worse outside its region. Adding one more overall parity bit lets it DETECT two errors while still correcting one, which is the standard extended form.
5

History and context

Richard Hamming published the code in 1950, having worked it out at Bell Labs where he had access to a relay computer only at weekends. His account of the motivation is refreshingly plain: the machine could tell something had gone wrong and then simply stopped, wasting the whole run, and he thought it should be able to do better.

What it added to the parity approach: a single parity bit detects one error and locates nothing. The two-dimensional grid in the parity blueprint locates an error but costs one bit per row and per column. Hamming's overlapping groups locate it with logarithmically few bits — for 11 data bits you need 4 parity bits where a grid would need far more. Same goal, three different costs, and the right choice depends on how much overhead the channel can afford.

Where it is used: ECC memory in servers uses a Hamming-derived code to correct single-bit errors caused by cosmic rays and electrical noise, silently, millions of times a day. Hamming distance — the number of positions in which two codewords differ — became a fundamental concept in coding theory and in fields far outside it, including genetics and machine learning.

Its neighbours in the space: Reed-Solomon handles bursts of adjacent errors and is what makes a scratched CD or an obscured QR code readable; convolutional and turbo codes suit continuous noisy streams like deep-space links; a simple retransmission request is often cheaper than any of them when the channel is bidirectional and cheap. Hamming's region is where errors are isolated, retransmission is impossible or expensive, and overhead must stay small.

Vật liệu

3

Blueprint liên quan

Các blueprint này chia sẻ kiến thức — kỹ thuật, vật liệu hoặc nguyên tắc

CC0 Phạm vi công cộng

Bản thiết kế này được phát hành theo CC0. Bạn tự do sao chép, sửa đổi, phân phối và sử dụng cho bất kỳ mục đích nào mà không cần xin phép.

Hỗ trợ nhà sáng tạo bằng cách mua sản phẩm qua bản thiết kế, nơi họ nhận Hoa hồng nhà sáng tạo do nhà bán hàng đặt, hoặc tạo phiên bản mới và kết nối trong bản thiết kế riêng để chia sẻ doanh thu.

Thảo luận

(0)

Đăng nhập để tham gia thảo luận

Đang tải bình luận...