- A binary tree is a hierarchical data structure in which each node has at most two children, typically called the left child and right child.
Node:
A structure that contains a value (data) and links to its children nodes.Root:
The topmost node in the tree.Leaf Node:
A node with no children (both left and right children are null).Internal Node:
A node with at least one child.Parent and Child:
A node that has links to other nodes is considered the parent of those nodes, and the linked nodes are its children.Subtree:
Any node along with its descendants forms a subtree.Height:
The longest path from a node to a leaf. The height of the tree is the height of the root node.Depth:
The path length from the root to a given node.
- Tree traversals are ways of visiting every node in a binary tree. Common traversal methods include:
- Insertion
- Deletion
- Searching
- Height Calculation
- Counting Nodes
- Counting Leaf Nodes
- Maximum Nodes: A binary tree with height k can have at most 2 ^ (k + 1) nodes.
- Minimum Height: For n nodes, the minimum heights of a binary trees have no strict rules for nodes placement or balance, so they can become skewed.