I was given a set of binary number to assemble it into gray code sequence: 111 000 110 011 001 100. Is their a specific way I have to do this? From What I read in the internet I think the following solution would be this:
Gray Code
000
001
011
110
111
100

Is this correct? would this be the final answer? Ive never done this before so Im not sure if this is correct.

Recommended Answers

All 3 Replies

I was given a set of binary number to assemble it into gray code sequence: 111 000 110 011 001 100. Is their a specific way I have to do this? From What I read in the internet I think the following solution would be this:
Gray Code
000
001
011
110
111
100

Is this correct? would this be the final answer? Ive never done this before so Im not sure if this is correct.

The sequence you have there isn't correct--there should only be one bit of difference between each number and the one that follows.

That's basically all you need to know for this problem. Start with one of the numbers, then look through the rest for ones that only differ by one bit; those are the ones that could possibly come next. Repeat until either you've got a complete list (all six numbers), or you can't finish because you're stuck with numbers that all differ by more than one bit from the last one in your list. If you get stuck, then go back to some point where you had to choose between more than one number--this might be the first number--and choose a different one that fits.

The sequence you have there isn't correct--there should only be one bit of difference between each number and the one that follows.

That's basically all you need to know for this problem. Start with one of the numbers, then look through the rest for ones that only differ by one bit; those are the ones that could possibly come next. Repeat until either you've got a complete list (all six numbers), or you can't finish because you're stuck with numbers that all differ by more than one bit from the last one in your list. If you get stuck, then go back to some point where you had to choose between more than one number--this might be the first number--and choose a different one that fits.

Like this?
000
001
011
111
110
100

Like this?
000
001
011
111
110
100

Exactly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.