Chapter 10Recursive Algorithms for Speed

We’ve seen that understanding recursion unlocks all sorts of new algorithms, such as searching through a filesystem. In this chapter, we’re going to learn that recursion is also the key to algorithms that can make our code run much, much faster.

In previous chapters, we’ve encountered a number of sorting algorithms, including Bubble Sort, Selection Sort, and Insertion Sort. In real life, however, none of these methods are actually used to sort arrays. Most computer languages have built-in sorting functions for arrays that save us the time and effort from implementing our own. And in many of these languages, the sorting algorithm that is employed under the hood is Quicksort.

The reason we’re going to ...

Get A Common-Sense Guide to Data Structures and Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.