Trees & Binary Search Trees

Nodes with children

A tree is a node with a value and references to child nodes. A binary tree gives each node at most two children, left and right. The top node is the root; nodes with no children are leaves.

Trees are everywhere in backend work: a comment thread (replies under replies), a category hierarchy, a filesystem, an HTML/JSON document.