counting in grey code

Status
Not open for further replies.

patchquinn

Junior Member level 1
Joined
Jan 7, 2003
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
ireland
Activity points
163
what is grey code with example

hi, this might seem like a dumb question, but is there a convention for counting in the grey code for an arbitrary number of bits? For example with 3 bits there are number of possibilities , 000, 001, 011, 010, 110,111,101,100
0r
000,001,011,010,110,100,101,111
when you get to four bits it gets more confusing, I assume you try to have the lower value numbers first. But there must be some sort of algorithm. cant seem to find one on the web
cheers
 

recursive grey code

Take the line 00,01,11,10
Reverse it 10,11,01,00
write a zero before each element of the first line 000,001,011,010
write a one before each element of the reversed line 110,111,101,100
and concatenate both
000,001,011,010,110,111,101,100

EDIT: but u cant say that finding generation rules on gray code is very hard.. google:"gray code" -> the fifth entry leads to http://yagni.com/graycode/

but thanks to you now i dont only know the recursive approach thanks


HTH
dsp_
 

thanks dsp_,
and regarding google search, being Irish I have been spelling it grey code rather than gray code, doh!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…