Book of programming problems

Contains advanced programming problems for schools, colleges and problem-hungry inidividuals

Find a code where subsequent numbers differ in one bit
Complexity (1-100): 27
Grey code is a code Grey(x) such that each succeeding code Grey(x-1) differs from its predecessors in one bit. Example:

xGrey(x)
0000
0001
0010
0011
0100
0101
0110
0111
0000
0001
0011
0010
0110
0111
0101
0100

There are more than one codes which hold this property. The task is to find such function Grey(x), which will map any integer number in the range 0..231-1 to its Grey code.
Solution:Show/hide explanation | Solution.hs
There are no posts in this topic.

Post Reply

Book of programming problems is powered by UseBB 1 Forum Software | Contact Admin