This function returns the sum of "n" different values. (The running time of an algorithm) But I want the function to return the average value of all those values instead of the sum. Anyone got any ideas?
Code:double sum(double alg, int n) { if (n == 1) { return alg; } return (alg + sum(alg,n-1)); }