Use constructive and well-formed examples, like Quicksort, to teach recursion so that students have a strong model for building their own solutions.
- The following topics are great because they provide efficient and appropriate uses of recursion:
- Quicksort;
- Printing values in a singly-linked list in reverse order;
- Tree traversals.
- You can also demonstrate how tail recursion is extremely efficient with certain compilers or interpreters (e.g., Scheme).
- As an example, use tail recursion to sum values in a list of numbers.