Gray Code

A tool for converting between standard binary and Gray code.

📚 About Algorithm

Gray code is a binary numeral system where two successive values differ in only one bit. This minimizes errors in digital communications.

  • Encoding (B → G): The first bit remains the same, each subsequent g[i] = b[i] ⊕ b[i-1].
  • Decoding (G → B): The first bit remains the same, each subsequent b[i] = g[i] ⊕ b[i-1].
  • Application: Rotary encoders, Karnaugh maps minimization, error correction in digital signals.

🔒 Encoding

// Waiting for input...

🔓 Decoding

// Waiting for input...