Skip to content

Glossary: Coding Interviews

Tree recursion

Also written: tree recursion pattern

The pattern for tree questions: return a base answer for an empty tree, ask each child for its answer, then combine them with the node's value. It costs O(n).

Where the book teaches it

Related terms

Base case