-
The shape of a binary tree will affect its performance as a data structure and is dependent on the initial order of the data set used to build the tree.
-
If the data set is already sorted (1 2 3 4...), the binary tree is essentially a linked list with an unused left pointer in each node.
-
A data set in random order will lead to a more balanced tree.
-
Ideally, we want binary trees that are balanced with almost equal numbers of nodes in each subtree of every node. A balanced binary tree is defined as follows:
For every node in the tree, the number of nodes in its left subtree is equal to the number of nodes in its right subtree, plus or minus one.
Please note: Balancing binary trees will not be covered in this curriculum.