Binary Tree
Binary Tree
Definition:
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.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.
A Binary tree is an ordered, rooted tree. Some authors use rooted binary tree instead
of binary tree to emphasize the fact that the tree is rooted, but as defined above, a binary tree is
always rooted. Don't necessarily label the children as left and right either.
Types:
A Rooted binary tree has a root node and every node has at most two
children.
A Complete binary tree is a binary tree in which every level, except possibly the last, is
completely filled, and all nodes in the last level are as far left as
possible. It can have between 1 and 2 h nodes at the last level h. A
perfect tree is therefore always complete but a complete tree is not
always perfect. Some authors use the term complete to refer instead
to a perfect binary tree as defined above, in which case they call this
type of tree (with a possibly not filled last level) an almost
complete binary tree or nearly complete binary tree. A complete
binary tree can be efficiently represented using an array.
The Infinite complete binary tree is a tree with levels, where for each level d the number of
existing nodes at level d is equal to 2d. The cardinal number of the set of all levels is (countably
infinite). The cardinal number of the set of all paths (the "leaves", so to speak) is uncountable,
having the cardinality of the continuum.