Unit-distance coding — which binary code progresses so that only one bit changes between any two successive code words (minimizing transition errors)?

Difficulty: Easy

Correct Answer: Gray code

Explanation:


Introduction / Context:
When digital systems encode ordered states (such as shaft angles or counter positions), changing multiple bits at once can create transient errors if not all lines switch simultaneously. A “unit-distance” code mitigates this by ensuring that adjacent values differ by only one bit.


Given Data / Assumptions:

  • We need a code where successive values differ by Hamming distance 1.
  • Use case includes encoders, ADCs, and state machines where transition glitches must be minimized.
  • We consider common codes: weighted BCD, complements, and Gray.


Concept / Approach:
Gray code (reflected binary code) is constructed so that each successive word differs from the previous one by exactly one bit. This property reduces ambiguity during transitions because even if lines switch at slightly different times, at most one bit is in flux, which minimizes decoding errors. Weighted codes like 8421 BCD can change multiple bits between successive numbers (e.g., 7→8 toggles four bits), increasing the risk of transient misreads.


Step-by-Step Solution:

Define unit distance: Hamming distance of 1 between neighbors.Recall Gray code sequence: 00, 01, 11, 10 for 2-bit; generalizes by reflection.Check weighted codes (8421): observe multi-bit toggles between sequential decimal values.Conclude that Gray code uniquely satisfies the one-bit-change criterion.


Verification / Alternative check:
Create a small 3-bit table and compare transitions: Gray code shows single-bit steps while straight binary shows multi-bit steps such as 3 (011) to 4 (100), which toggles three bits.


Why Other Options Are Wrong:

9's complement/excess-3: intended for decimal arithmetic and self-complementing properties, not unit-distance transitions.8421 BCD: weighted; adjacent decimal digits often change several bits.ASCII: character code, not numeric progression code.


Common Pitfalls:
Confusing “nonweighted” with “unit distance”; some codes are nonweighted yet not strictly single-bit transition for all sequences.


Final Answer:
Gray code

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion