A tree is a hierarchical data structure. It consists of nodes with a root node at the top and subtree of children nodes. The nodes are connected by edges. Each parent node can point to null, one or multiple nodes.

A binary tree has at most two children, we name them left child and right child. It can have a minimum of zero nodes, which occurs when the nodes are leaves. The complexity is O(n) in the worst case.