Chapter 11
Programming Recursions

The idea of recursion—solving a problem using solutions to its subproblems—is alluring. Many algorithms and problems are recursive in nature. Once we get the hang of it, designing solutions using recursion becomes highly expressive and intuitive.

In general, the biggest catch with recursions is stack overflow for large input values. But, thankfully that’s not so in Scala for specially structured recursions. In this chapter we explore the powerful tail call optimization techniques and the support classes baked into Scala and its library, respectively. Using these easy-to-access facilities, you can implement highly recursive algorithms and reap their benefits for really large input values without blowing out the stack.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.164.241