today i finished the last exercise on functions, it was about writting a prog that takes 2 numbers, and gives u the power, u had to do this using recursion. after i finished it i went back to check the answer and tested the answer the book had, well i have to say that i was disappointed.
they only tested for 1 base case when in a prog like this u have to test for 2 correct?
they were only testing forCode:{ if (power == 1) return n; { if (power ==0) return 1; else return (n * PowerFunc(n,power -1)); }
so would u say that their answer was incomplete?Code:if (power == 1) return n;
another question, recursion function do they always have 2 base cases? should i email them to correct it? eheh



LinkBack URL
About LinkBacks


