int BinaryToGray(int binary)
{
int gray = 0;
int bit = 0;
int convert[4] = {0,1,1,0};
while(binary)
{
int value = convert[binary%4];
gray |= value << bit;
++ bit;
binary >>= 1;
}
}
vector<int> GrayCode(int n)
{
vector<int> codes;
for(int i=0; i< (1<<n); ++i)
codes.push_back((i>>1) ^ i);
return codes;
}