Rooted Tree

2 min read Updated Mon Apr 27 2026 04:57:01 GMT+0000 (Coordinated Universal Time)

A tree where a vertex is designated as the root vertex.

Height

Length of the longest path from the root.

Level

For a given vertex vv, length of the simple path from the root to vv.

Parent

For a given vertex vv, its parent vertex is the unique vertex uu where level(u)<level(v)\text{level}(u) \lt \text{level}(v) and there is an edge between uu and vv.

Child

For a given vertex vv, uu is a child of vv iff vv is the parent of uu.

Siblings

Vertices with the same parent.

Ancestors

For a given vertex vv, all vertices in the path from the root to vv, excluding vv and including the root.

Descendants

For a given vertex vv, all vertices that have vv as their ancestor.

Leaf

In a rooted tree, a leaf does not have any children.

Internal vertices

Vertices that have children.

Sub-rooted tree

Suppose aa is a vertex in a tree. Then the sub-tree with aa as its root is the sub-graph of the tree consisting of aa and its descendants and all edges incident to these descendants.

Decision tree

Vertices represent the decision points or events, where a decision could be made. Edges represent the possible decisions/outcomes of different choices.

Representation of Algebraic Expressions

There are 3 common forms of algebraic expressions.

Infix form

The symbol is written in-between the operands. The form we usually use.

Example: xyx*y

Prefix form

Aka. Polish form. The symbol is written before the operands.

xyx*y’s prefix form is: xy* x y

Parantheses are not required.

Postfix form

Aka. reverse Polish form. The symbol is written after the operands. Used commonly when parsing algebraic expressions in calculators.

xyx*y’s prefix form is: xyx y *