CHAPTER 6

Recursion

In this chapter, we will explain the following:

- What a recursive definition is
- How to write recursive functions in C
- How to convert from decimal to binary
- How to print a linked list in reverse order
- How to solve Towers of Hanoi
- How to write an efficient power function
- How to sort using merge sort
- What are static variables
- How to use recursion to keep track of pending subproblems
- How to implement backtracking using recursion by finding a path through a maze

6.1 Recursive Definition

A *recursive definition* is one that is defined in terms of itself. Perhaps the most common example is the *factorial* function. The factorial of ...

Start Free Trial

No credit card required