File:Binary_tree_v2.svg · Wikimedia Commons · See Wikimedia Commons
binary tree
Sign in to savetree data structure in which each node has at most two children
Wikidata facts
- Image
- Binary tree.svg
Show 2 more facts
- Stack Exchange tag
- stackoverflow.com/tags/binary-tree
- Commons category
- Binary trees
via Wikidata · CC0
~27 min read
Article
A labeled binary tree of size 9 (the number of nodes in the tree) and height 3 (the height of a tree defined as the number of edges or links from the top-most or root node to the farthest leaf node), with a root node whose value is 1. The above tree is unbalanced and not sorted.
In computer science, 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. That is, it is a k-ary tree where k = 2. A recursive definition using set theory is that a binary tree is a triple (L, S, R), where L and R are binary trees or the empty set and S is a singleton (a single–element set) containing the root.