请输入您要查询的字词:

 

单词 Gray Code
释义

Gray Code

An encoding of numbers so that adjacent numbers have a single Digit differing by 1. A Binary Gray code with Digits corresponds to a Hamiltonian Path on an -D Hypercube (including direction reversals). The term Gray code is often used to refer to a ``reflected'' code, or more specifically still, the binary reflected Gray code.


To convert a Binary number to its corresponding binary reflected Gray code, start at theright with the digit (the th, or last, Digit). If the is 1, replace by ; otherwise,leave it unchanged. Then proceed to . Continue up to the first Digit , which is kept the same since is assumed to be a 0. The resulting number is the reflected binary Gray code.


To convert a binary reflected Gray code to a Binary number, start again with the thdigit, and compute


If is 1, replace by ; otherwise, leave it the unchanged. Next compute


and so on. The resulting number is the Binary number corresponding to the initial binaryreflected Gray code.


The code is called reflected because it can be generated in the following manner. Take the Gray code 0, 1. Write it forwards,then backwards: 0, 1, 1, 0. Then append 0s to the first half and 1s to the second half: 00, 01, 11, 10. Continuing, write 00,01, 11, 10, 10, 11, 01, 00 to obtain: 000, 001, 011, 010, 110, 111, 101, 100, ... (Sloane's A014550). Each iteration thereforedoubles the number of codes. The Gray codes corresponding to the first few nonnegative integers are given in the followingtable.


00201111040111100
11211111141111101
211221110142111111
310231110043111110
4110241010044111010
5111251010145111011
6101261011146111001
7100271011047111000
81100281001048101000
91101291001149101001
101111301000150101011
111110311000051101010
1210103211000052101110
1310113311000153101111
1410013411001154101101
1510003511001055101100
16110003611011056100100
17110013711011157100101
18110113811010158100111
19110103911010059100110

The binary reflected Gray code is closely related to the solution of the Towers of Hanoias well as the Baguenaudier.

See also Baguenaudier, Binary, Hilbert Curve, Ryser Formula, Thue-Morse Sequence,Towers of Hanoi


References

Gardner, M. ``The Binary Gray Code.'' Ch. 2 in Knotted Doughnuts and Other Mathematical Entertainments. New York: W. H. Freeman, 1986.

Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; and Vetterling, W. T. ``Gray Codes.'' §20.2 in Numerical Recipes in FORTRAN: The Art of Scientific Computing, 2nd ed. Cambridge, England: Cambridge University Press, pp. 886-888, 1992.

Sloane, N. J. A. Sequence A014550in ``The On-Line Version of the Encyclopedia of Integer Sequences.''http://www.research.att.com/~njas/sequences/eisonline.html.

Vardi, I. Computational Recreations in Mathematica. Redwood City, CA: Addison-Wesley, pp. 111-112 and 246, 1991.

随便看

 

数学辞典收录了8975条数学词条,基本涵盖了常用数学知识及数学英语单词词组的翻译及用法,是数学学习的有利工具。

 

Copyright © 2000-2023 Newdu.com.com All Rights Reserved
更新时间:2024/11/15 2:39:58