📄 graycode.html
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD W3 HTML 2.0//EN">
<HTML lang="en-US">
<HEAD>
<TITLE>Gray code</TITLE>
<META name="description"
content="Definition of Gray code,
possibly with links to more information and implementations.">
<META name="keywords" content="Gray code">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H1>Gray code</H1>
<P>
(definition)
<P>
<strong>Definition:</strong>
An ordering of 2<sup>n</sup> binary numbers such that only one bit changes from one entry to the next.
<P><strong>See also</strong>
<a href="karnaughmap.html" tppabs="http://hissa.nist.gov/dads/HTML/karnaughmap.html"><em>Karnaugh map</em></a>.
<P><em>Note:
Gray codes are useful in mechanical encoders since a slight change in location only affects one bit. Using a typical binary code, up to n bits could change, and slight misalignments between reading elements could cause wildly incorrect readings. <br> One Gray code for 3 bits is (000, 010, 011, 001, 101, 111, 110, 100). A Gray code corresponds to a <a href="hamilcyc.html" tppabs="http://hissa.nist.gov/dads/HTML/hamilcyc.html"><em>Hamiltonian cycle</em></a> on an n-dimensional hypercube. Note: Gray codes are not unique. <br> One way to construct a Gray code for n bits is to take a Gray code for n-1 bits with each code prefixed by 0 (for the first half of the code) and append the n-1 Gray code reversed with each code prefixed by 1 (for the second half). Here is an example of creating a 3-bit Gray code from a 2-bit Gray code. <br> 00 01 11 10 A Gray code for 2 bits<br> 000 001 011 010 the 2-bit code with a zero prefix<br> 10 11 01 00 the 2-bit code reversed<br> 110 111 101 100 the reversed code with a one prefix<br> 000 001 011 010 110 111 101 100 A Gray code for 3 bits</em>
<P>Author: <a href="terms.html#authorPEB" tppabs="http://hissa.nist.gov/dads/terms.html#authorPEB">PEB</a>
<hr>
Go to the
<A HREF="terms.html" tppabs="http://hissa.nist.gov/dads/terms.html">Algorithms, Data Structures, and Problems</A>
home page.
<hr>
If you have suggestions, corrections, or comments, please get in touch
with
<a href="javascript:if(confirm('http://hissa.nist.gov/~black/black.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://hissa.nist.gov/~black/black.html'" tppabs="http://hissa.nist.gov/~black/black.html">Paul E. Black</a>
(<a href="mailto:paul.black@nist.gov">paul.black@nist.gov</a>).
<p>
Entry modified Thu Dec 16 09:42:47 1999.<BR>
HTML page formatted Wed Dec 22 09:35:27 1999.
<P>
This page's URL is
<A href="graycode.html" tppabs="http://hissa.nist.gov/dads/HTML/graycode.html">http://hissa.nist.gov/dads/HTML/graycode.html</A>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -