given all binary numbers of n digits in sorted order then how to arrange them such that each consecutive elements differ in only a bit.

for eg :- 00 01 10 11

this into this :- 00 01 11 10

Source: Windows Questions C++

given all binary numbers of n digits in sorted order then how to arrange them such that each consecutive elements differ in only a bit.

for eg :- 00 01 10 11

this into this :- 00 01 11 10

Source: Windows Questions C++