## Recent Post

A tree consists of finite set of elements, called nodes, and a finite set of directed lines called branches, that connect the nodes.

The number of branches associated with a node is the degree of the node.

When the branch is directed towards the node, it is indegree branch.

When the branch is directed away from the node, it is an outdegree branch.

The sum of the indegree and outdegree branches is the degree of the node.

If the tree is not empty, the first node is called the root.

The indegree of the root is, by definition, zero.

With the exception of the root, all of the nodes in a tree must have an indegree of exactly one; that is, they may have only one predecessor.

All nodes in the tree can have zero, one, or more branches leaving them; that is, they may have outdegree of zero, one, or more.

A leaf is any node with an outdegree of zero, that is, a node with no successors.

A node that is not a root or a leaf is known as an internal node.

A node is a parent if it has successor nodes; that is, if it has outdegree greater than zero.

A node with a predecessor is called a child.

Two or more nodes with the same parents are called siblings.

An ancestor is any node in the path from the root to the node.

An descendant is any node in the path below the parent node; that is all nodes in the paths from a given node to a leaf are descendants of that node.

A path is a sequence of nodes in which each node is adjacent to the next node.

The level of a node is its distance from the root. The root is at level 0, its children are at level 1, etc...

The height of the tree is the level of the leaf in the longest path from the root plus 1. By definition the height of any empty tree is -1.

A subtree is any connected structure below the root. The first node in the subtree is known is the root of the subtree.