Sorting numbergroups problem - Java-Games

This is a discussion on Sorting numbergroups problem - Java-Games ; Hi, I have 18 numbers. I pack those numbers into 153 number-pairs in a way so each of the numbers is once assigned to another number without the possibility of one pair appearing twice, or one number being assigned to ...

+ Reply to Thread
Results 1 to 3 of 3

Sorting numbergroups problem

  1. Default Sorting numbergroups problem

    Hi,

    I have 18 numbers. I pack those numbers into 153 number-pairs in a way so
    each of the
    numbers is once assigned to another number without the possibility of
    one pair appearing twice, or one number being assigned to itself

    18:17
    18:16
    ....
    18:1
    17:16
    17:15
    ....
    17:1
    16:15
    ....
    ....
    2:1

    Now I want to group those 153 pairs into 17 groups of 9 pairs each in a way
    so each number appears
    only once in a group an each group has exactly 9 pairs:

    Example
    Group 1:
    1:2
    3:4
    5:6
    7:8
    9:10
    11:12
    13:14
    15:16
    17:18

    Group 2:
    1:3
    2:4
    5:8
    6:7
    9:12
    12:10
    13:15
    17:16
    15:18

    Group 3:
    ....


    I tried around and haven't found any sorting- or other algorithm which could
    have done something like this...
    Anybody with an idea?



  2. Default Re: Sorting numbergroups problem

    Google "tournament scheduling." Also check
    http://www.devenezia.com/downloads/r...is.round-robin


  3. Default Re: Sorting numbergroups problem

    #include <stdio.h>

    int main(void)
    {
    int i, j, t, n, g, player[1000];

    n = 18; // can be any even number
    for (g = 1; g < n; g++) {
    printf("Group %d:\n", g);
    for (i = 0, j = n - 1; i < j; i++, j--)
    printf(" %d:%d\n", player[i], player[j]);
    t = player[1];
    for (j = 1; j < n - 1; j++)
    player[j] = player[j+1];
    player[j] = t;
    }
    return 0;
    }


+ Reply to Thread

Similar Threads

  1. problem sorting a set
    By Application Development in forum c++
    Replies: 1
    Last Post: 10-16-2007, 07:17 PM
  2. strange problem of sorting
    By Application Development in forum c++
    Replies: 7
    Last Post: 07-08-2007, 08:31 AM
  3. Problem with XSL and sorting
    By Application Development in forum XML SOAP
    Replies: 3
    Last Post: 09-09-2006, 10:57 AM
  4. Sorting strings problem
    By Application Development in forum Java
    Replies: 2
    Last Post: 06-01-2004, 05:32 PM
  5. Problem with sorting via folder-hook
    By Application Development in forum Mutt
    Replies: 1
    Last Post: 05-04-2004, 05:13 AM