In the previous chapter, you learned how to write recursively and how to use recursion to solve some rather complex problems.
While recursion can certainly solve some problems, it can also create new ones if not used properly. In fact, recursion is often the culprit behind some of the slowest categories of Big O, such as O(2N).
The good news, though, is that many of these problems can be avoided. In this chapter, you’ll learn how to identify some of the most common speed traps found in recursive code and how to express such algorithms in terms of Big O. More important, you’ll learn the techniques to fix these problems.
Here’s some more good news: the techniques found in this chapter are pretty simple. Let’s take a look at how to use these easy but effective methods for turning our recursive nightmares into recursive bliss.