1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Help with planning a recursive function

Discussion in 'C' started by ronSSS, Dec 15, 2007.

  1. ronSSS

    ronSSS New Member

    Joined:
    Dec 15, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi ,My name is Ron and I'm new here.

    I would very welcome some help with an exercise. Some hints and ideas would be very helpful.

    The exercise:

    I have 'n' students and 'k' sits ,and I need to build a function (in C) that need to print
    all the combinations ,while there are some rules:
    * n>=2k-1;
    * every two students must be divided by at least one sit;
    * I must use an array of STUDENTS , each cell contains only '0' or '1' ;
    * the function must be recursive ,and contain no 'FOR' or 'WHILE' loops.

    For example, n=5 ,k=2 the output would be :
    00101
    01001
    01010
    10001
    10010
    10100

    any hints would be welcomed.

    10x and good day.
     

Share This Page