Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement Gray Code Generator with Unit Tests for n-bit Sequences#932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Simranstha045 wants to merge1 commit intokeon:master
base:master
Choose a base branch
Loading
fromSimranstha045:add-graycode

Conversation

@Simranstha045
Copy link

Description:

This pull request adds thegray_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.

Copy link

@EXD-PeterbotEXD-Peterbot left a comment

Choose a reason for hiding this comment

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

H

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

2 more reviewers

@EXD-PeterbotEXD-PeterbotEXD-Peterbot left review comments

@Babu464-ksBabu464-ksBabu464-ks approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@Simranstha045@Babu464-ks@EXD-Peterbot

[8]ページ先頭

©2009-2025 Movatter.jp