17D. Summary

Recursion is an alternative to loops, and it works for expressing scan algorithms and search algorithms.

Tail recursion is the special case of recursion where the function does nothing after doing the recursive call except possibly return the result of the recursive call. Tail recursion has an advantage over general recursion: a compiler will convert tail recursion into a loop for you (if you ask for it by requesting optimization).

Often, search algorithms turn out to be tail recursive. Just as any tail-recursive function can be converted to a loop, any loop can be converted to a tail-recursive function definition.

But don't feel that you always need to use tail recursion. The goal is to express algorithms in a clear and transparently correct form. If that ends up using general recursion, that is fine.