Two versions of a function that adds up a range of ints, addup(3, 7) should be 3 + 4 + 5 + 6 + 7 which is 35. int addup_one(const int first, const int last) { if (first == last) return first; return first + addup_one(first + 1, last); } int addup_two(const int first, const int last) { if (first > last) return 0; return first + addup_two(first + 1, last); } the sum of a sequence of squares is pretty much the same: addup_squares(3, 7) should be 9 + 16 + 25 + 36 + 49 = 135. int addup_squares(const int first, const int last) { if (first > last) return 0; return first * first + addup_squares(first + 1, last); } factorial can follow the same pattern like this: int multiply(const int first, const int last) { if (first > last) return 1; return first * multiply(first + 1, last); } int factorial(const int n) { return multiply(1, n); } or as its own independent function: int factorial(const int n) { if (n == 0) return 1; return n * factorial(n - 1); } The minimum value of the function f(x) over a range of x values: int f(const int x) { return 3 * x * x - 7 * x + 4; } int mini(const int first, const int last) { if (first == last) return f(first); if (f(first) < mini(first + 1, last)) return f(first); return mini(first + 1, last); } That version isn't very good, too many re-calculations of the same thing, so: int mini(const int first, const int last) { const int f_first = f(first); if (first == last) return f_first; const int f_others = mini(first + 1, last); if (f_first < f_others) return f_first; return f_last; } Note that mini can't use the test for first > last, what could the minimum of a collection of nothing possibly be? Numeric integration, finding the area between the graph of y = sin(x) and the x axis in the range x = first to x = last by approximating it with a sequence of very thin quadrilaterals (this subject area is called numerical analysis, it is mostly about calculating things that we don't know an exact formula for): double integrate_sine(const double first, const double last) { if (first >= last) return 0.0; const double step = 0.01; const double this_quadrilateral = step * (sin(first) + sin(first + step)) / 2.0; const double the_rest = integrate_sine(first + step, last); return this_quadrilateral + the_rest; } USEFUL EXERCISES TO TRY define your own sine function using the method illustrated in next class' notes. calculating exponentials is a little simpler, but worth a try: expo(x) = 1 + x + power(x, 2) / factorial(2) + power(x, 3) / factorial(3) + power(x, 4) / factorial(4) + power(x, 5) / factorial(5) and so on for quite a few terms given an array of ints and its length, find the smallest of them. given an array of strings A, and its length L, and another single string Q, return true if Q is the same as one of the strings in A, false if it isn't.