Permutation test

You are encouraged to solve this task according to the task description, using any language you may know.
A new medical treatment was tested on a population of 



n
+
m


{\displaystyle n+m}


volunteers, with each volunteer randomly assigned either to a group of




n


{\displaystyle n}

 treatment subjects, or to a group of 



m


{\displaystyle m}

 control subjects.

Members of the treatment group were given the treatment,
and members of the control group were given a placebo.
The effect of the treatment or placebo on each volunteer
was measured and reported in this table.


 Table of experimental results


 Treatment group 
 Control group


 85 
 68


 88 
 41


 75 
 10


 66 
 49


 25 
 16


 29 
 65


 83 
 32


 39 
 92


 97 
 28


 
 98

Write a program that performs a
permutation test to judge
whether the treatment had a significantly stronger effect than the
placebo.

 Do this by considering every possible alternative assignment from the same pool of volunteers to a treatment group of size 



n


{\displaystyle n}

 and a control group of size 



m


{\displaystyle m}

 (i.e., the same group sizes used in the actual experiment but with the group members chosen differently), while assuming that each volunteer's effect remains constant regardless.
 Note that the number of alternatives will be the binomial coefficient 







(



n
+
m

n


)






{\displaystyle {\tbinom {n+m}{n}}}

.
 Compute the mean effect for each group and the difference in means between the groups in every case by subtracting the mean of the control group from the mean of the treatment group.
 Report the percentage of alternative groupings for which the difference in means is less or equal to the actual experimentally observed difference in means, and the percentage for which it is greater.
 Note that they should sum to 100%.


Extremely dissimilar values are evidence of an effect not entirely due
to chance, but your program need not draw any conclusions.

You may assume the experimental data are known at compile time if
that's easier than loading them at run time. Test your solution on the
data given above.




#include <stdio.h>
 
int data[] = {  85, 88, 75, 66, 25, 29, 83, 39, 97,
                68, 41, 10, 49, 16, 65, 32, 92, 28, 98 };
 
int pick(int at, int remain, int accu, int treat)
{
        if (!remain) return (accu > treat) ? 1 : 0;
 
        return  pick(at - 1, remain - 1, accu + data[at - 1], treat) +
                ( at > remain ? pick(at - 1, remain, accu, treat) : 0 );
}
 
int main()
{
        int treat = 0, i;
        int le, gt;
        double total = 1;
        for (i = 0; i < 9; i++) treat += data[i];
        for (i = 19; i > 10; i--) total *= i;
        for (i = 9; i > 0; i--) total /= i;
 
        gt = pick(19, 9, 0, treat);
        le = total - gt;
 
        printf("<= : %f%%  %d\n > : %f%%  %d\n",
               100 * le / total, le, 100 * gt / total, gt);
        return 0;
}