Recursion and trees

Functions that call themselves, and how to walk a binary tree.

A recursive function needs a base case that stops it, and each call must move towards that base case.

Expected output
120

Binary trees

In a binary search tree, smaller values go left and larger values go right. An in-order walk therefore visits them in sorted order.

Expected output
[1, 2, 3, 4, 6]
3
โ† Searching and sortingGraphs: BFS and DFS โ†’