As a part of a larger problem I have to solve the following::
*input - number of variables (say n=4)
*input - 'n' numbers in decimal (say 1,3,5,7)
*I need to check for all the grey code neighbours
i.e, to say, 2=00000001(a fixed length string) and
3=00000011(a fixed length string) differ EXACTLY IN ONE BIT.
so they form gery code neighbours and form a duet 000000x1.
* for the above example we get 4 gery code neighbours (so 4 duets)
which are 0000001x (from 1 and 3),
00000x01 (from 1 and 5),
00000x11 (from 3 and 7),
000001x1 (from 5 and 7)
*now I need to combine all the duets. for eg (1 and 5) and (3 and 7) combine to give a QUAD 000000xx1.()
for the above example we get 2 quads--which turn our to be the same.
*now I need to combine the quads to get 8's
* I need to go on and create lists of 1)all singletons
2)all duets
3)all quads
and so on.
so far I've managed to read the inputs and save them in a list of strings ,each string representing one input in binary
i.e, list of 00000001, 00000011, 00000101, 00000111 as strings.
Iam not able to decide how to proceed.
This is the first time Iam writing anything so complex.(I haven't written codes for anything more than sorting numbers before.)This one is for an assignment.
Iam not able to decide what data structures to use
Plz suggest any good way of approaching the problem.