Recursion

In previous chapters, we learned about different iterative data structures. Starting with next chapter, we will start using a special method to make it easier to write the algorithms used to access the tree and graph data structures, which is recursion. But before we start diving into trees and graphs, we need to understand how recursion works.

In this chapter, we will cover:

  • Understanding recursion
  • Calculating the factorial of a number
  • The Fibonacci sequence
  • JavaScript call stack

Get Learning JavaScript Data Structures and Algorithms - Third Edition 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.