View Single Post
Peon666
#1
Dec3-09, 12:18 PM
P: 110
1. The problem statement, all variables and given/known data

I need to implement a recursive code for generating the Gray code for a given number of bits. For example, if the input bit is 1 it generates Gray code for 1 bit number i.e 0 and 1. Given 2, it generates Gray code for 2 bit numbers i.e 00 and 01 and so on. I don't understand how to implement and what should be the base case.

I'd be really grateful in case of any help.

Thanks.

2. Relevant equations



3. The attempt at a solution
Phys.Org News Partner Science news on Phys.org
NASA team lays plans to observe new worlds
IHEP in China has ambitions for Higgs factory
Spinach could lead to alternative energy more powerful than Popeye