Reversing a list using standard recursion:
Reversing a list using tail recursion:
(See the
lecture code
for the implementation of the next two functions.)
Flattening a tree using standard recursion:
Flattening a tree using (some) tail recursion: