August 2020
Intermediate to advanced
508 pages
11h 53m
English
Recursion is a key concept in computer science that will unlock the more advanced algorithms we’re going to encounter in this book. When used correctly, recursion can be used to solve certain types of tricky problems in surprisingly simple ways. Sometimes, it even seems like magic.
But before we dive in, a pop quiz!
What happens when the blah() function defined here is called?
| | function blah() { |
| | blah(); |
| | } |
As you probably guessed, it will call itself infinitely, since blah() calls itself, which in turn calls itself, and so on.
Recursion is the term for a function calling itself. Indeed, infinite recursion, as in the above example, is utterly useless. When harnessed correctly, though, recursion ...
Read now
Unlock full access