Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Fix graph missing problem in blog
Browse files Browse the repository at this point in the history
  • Loading branch information
mendax1234 committed Aug 22, 2023
1 parent 2161f61 commit f2ec843
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/blog/posts/binary-to-gray-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ In short, the advantage of Gray code is that juts one bit changes for each step.
1. The Most Significant Bit (MSB) of the gray code is always equal to the MSB of the given binary code.
2. Other bits of the output gray code can be obtained by XORing binary code bit at that index and previous index.

<p align="center"> <img src="/blog/assets/binary-to-gray-code/Gray-Code1.png" title = "Binary code to gray code conversion"> </p>
<p align="center"> <img src="/blog/binary-to-gray-code/Gray-Code1.png" title = "Binary code to gray code conversion"> </p>

### Gray code to Binary Conversion
1. The Most Significant Bit (MSB) of the binary code is always equal to the MSB of the given gray code.
2. Other bits of the output binary code can be obtained by checking the gray code bit at that index. If the current gray code bit is 0, then copy the previous binary code bit, else copy the invert of the previous binary code bit.

<p align="center"> <img src="/blog/assets/binary-to-gray-code/Gray-Code2.png"> </p>
<p align="center"> <img src="/blog/binary-to-gray-code/Gray-Code2.png"> </p>

## Acknowledgement
- [**The definition of Gray Code on Wikipedia**](https://en.wikipedia.org/wiki/Gray_code)
Expand Down

0 comments on commit f2ec843

Please sign in to comment.