Main Page | See live article | Alphabetical index

Leaf node

In computer science, a leaf node is a node of a tree data structure that has zero child nodes. Often, leaf nodes are the nodes farthest from the root node. Some trees only store data in leaf nodes, though this affects the dynamics of storing data in the tree.

For example, with empty leaves, one can store an empty tree with a single leaf node. However with leaves that can store data, it is impossible to store an empty tree unless one stores some kind of marker data in the leaf that signifies that the leaf is to be empty (and thus the tree to be empty as well).

See also: Binary tree