keon / algorithms

Minimal examples of data structures and algorithms in Python
MIT License
24.1k stars 4.61k forks source link

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

Open Simranstha045 opened 1 month ago

Simranstha045 commented 1 month ago

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: