int sumHelper(int n, int a) {
if (n==0) return a;
else return sumHelper(n-1, a + n*n);
}
int sumSqr(int n) {
return sumHelper(n, 0);
}
Guys, I am supposed to prove this piece of code which uses tail recursion to sum up the square of numbers. ie, Prove that for n ≥ 1,sumsqr(n)=1^2+2^2+...n^2. I have figured out the base case but I am stuck at the induction step. Any hints or help will be appreciated.