Conversation

Simranstha045

Description:

This pull request adds the gray_code(n) function and corresponding unit tests to generate and verify n-bit Gray code sequences. Gray code is a numeral system used in digital systems where two successive values differ by only one bit.

Key Features:

  • Gray Code Generator:

    • The function recursively generates Gray codes for any n-bit length by building on previous sequences and mirroring them.
    • Returns Gray code in decimal representation.
  • Comprehensive Unit Tests:

    • A set of unit tests is included to validate the correctness of the Gray code generator for various bit lengths.
    • Tests for 0-bit, 1-bit, 2-bit, 3-bit, and 4-bit Gray code sequences, ensuring accuracy of the output.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

H

Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.