I have a list which has always even item count.
I need an algorithm to find all two member combinations.
For instance if item count is 4, output will be;
Items:
{1, 2, 3, 4 }
ResulSet:
{12}, {34}
{13}, {24}
{14}, {23}
Order makes no difference, {12} covers {21}.
For item count 6, output will be;
Items:
{1, 2, 3, 4, 5, 6}
ResulSet:
12 34 56
12 35 46
12 36 45
13 24 56
13 25 46
13 26 45
14 23 56
14 25 36
14 26 35
15 23 46
15 24 36
15 26 34
16 23 45
16 24 35
16 25 34
Could you show me a way please?
Thank you.
Edit:
Question is really short to read, and if you take 1 minute to read question you can see it is not duplicate like most of people think (probably they are semi-illiterate)
Combination of {1, 2, 3, 4, 5, 6} is
123456 and as you see at top, this is not what I'm looking for. Read question if you want to help or just get off.
Have a nice day.