For all the functions in this assignment I want you to write a recursive function. As in the second problem set, some of these functions are not ones that you'd naturally write recursively. Others, however, are.

As in the previous assignment, for functions the recurse on arrays, you may want to use the fact that s.slice(1) returns an array consisting of all but the first element of xs. E.g. [2, 3, 5, 7, 11].slice(1) evaluates to a new array [3, 5, 7, 11]. Similarly you can recurse on strings using s.substring(1) to get the string containing all but the first character of s.

This problem set contains a couple problems that ask you to recurse on arrays the represent trees. I.e. instead of building a tree out of objects we build a tree out of nested arrays. In this kind of recursion, you'll usually have a double recursion, one recursing on the 0th element of the array and the other recurling on the rest (i.e. the slice(1)) of the array.

Put definitions here.

Revisions: