Recursion occurs when a function calls itself. To write a recursive algorithm, typically we first specify the base case, at which point the algorithm should return some value, and then do the work of the problem until we get to the base case. A **recursion tree** can be used to visualize the process. The **depth** of the tree refers to the number of levels of recursion. Poorly designed recursions (or in the presence of very large inputs) will reach a max recursion depth and return an error.