Part of my program requires writing a function that determines the number of subsets of k items that can be chosen from a set of n distinct objects ("n choose k" or n!/((n-k)! n!)). The only errors I am getting are from the first line of the function:
// n choose k: distinct subsets of k items chosen from n items public static int choose (int n, int k) { if (k <= 0) return 1; else return choose(n--, k--) * (n/k); }
Any help that I can get to find out what is wrong with this would be extremely helpful. Thanks!