Binary tree

Edit · View history

Binary tree

A binary tree is a tree data structure in which each node has at most two children, referred to as the left child and the right child. Binary trees are a fundamental structure in computer science, used for efficient searching, sorting, and hierarchical data representation.

Properties

In a binary tree, the degree of any node (the number of children) is 0, 1, or 2. The root is the topmost node, and nodes with no children are called leaves. Common variants include:

Traversals

A binary tree can be traversed in several standard orders:

History

The concept of a binary tree originated in mathematics and early computing. The term was popularized by computer scientists such as Donald Knuth in 1, which formalized tree structures and algorithms for binary tree manipulation. Binary trees have since become a core topic in algorithms and data structures courses.

Applications

Binary trees are used in many areas:

Related structures