Trees & Binary Search Trees

A node with children

A tree is like a linked list that branches. A binary tree node holds a value and two child pointers, left and right (either may be nil). The top node is the root; a node with no children is a leaf.

Trees model anything hierarchical: a comment thread with replies, a category tree, a file system.