O'Reilly logo

C# Primer Plus by Klaus Michelsen

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 23. RECURSION FUNDAMENTALS

You will learn about the following in this chapter:

  • Recursive methods and recursion

  • The ability of C# to support pending method instances of the same method, and why this is an imperative ability when implementing recursive methods

  • The key ingredients of a successful recursive method

  • The fundamental reasons why recursion works

  • Recursion versus iteration

  • Binary search implemented using recursion instead of iteration

In this book, you have seen many examples of methods calling other methods. For example MethodA might, from within its method body, call MethodB to help MethodA accomplish a certain task. C# also allows a method to call itself. If MethodA's body contains a call to MethodA, MethodA is said to call itself. ...

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