hi guys,
i really need help on this problem. i have a code, but i need to convert it to algorithm.but i dont know how since im still new in this programming matter. hope u guys can help me please....
thanks for advance.
public static void calculateTotalTupples(int p, int s, String set)
{
int n = p, r = s;
int[] value = new int[n];
StringTokenizer v = new StringTokenizer (set,",");
int i=0;
while(v.hasMoreTokens())
{
value[i] = Integer.parseInt(v.nextToken());
i++;
}
int total =0;
CombinationGenerator gen = new CombinationGenerator(n,r);
while(gen.hasMore())
{
int[] comb = gen.getNext();
int totalElement =1;
for(int j=0;j<comb.length;j++)
{
totalElement *= value[comb[j]];
}
total += totalElement;
}
tupples = total;
}