O'Reilly logo

Introduction to Recursive Programming by Manuel Rubio-Sanchez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 9

Mutual Recursion

Alone we can do so little, together we can do so much.

—Helen Keller

A method that invokes itself directly within its body is recursive, by definition. However, a recursive method does not necessarily have to call itself. It may call another one that in turn calls it back. Thus, invoking the method can provoke multiple calls to it. This type of recursion is called mutualRecursive!type!mutual or indirectRecursive!type!indirect.

In general, several methods are mutually recursive when they invoke themselves in a cyclical order. For instance, consider a set of methods { f 1 , f 2 , , f n } . If f 1 calls f 2 , f 2 calls f 3 , and so on, and finally f n calls back f 1

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required