Definition

An ordered tree is a finite set of objects, N called the nodes and an ordered set of nodes valued function child() on the nodes such that

  1. There is a distinguished node n MATH , called the "root".

  2. (MATHchild(n)) $\cup ${n MATH}$\QTR{bs}{=}$N

  3. MATH child(n MATH) $=\phi $

  4. The set of nodes with child(n) $=\phi $ is called the set of "leaves".

  5. We will use the notation N for the set of nodes and the tree interchangeably. We will use N $_{\text{i}}$

to denote the subtree with root n MATH

Definition

Using array notation, child(n) $=$ n[i] MATH we define the notion of an "ordered walk", which in general terms looks like

traverse(N){

mark(root(N));

for(i=1;i<\child(root(N))\;i++){

traverse(N $_{\text{i}}$);

}

}


Figure

The ordered walk

r, a, c, f, g, d, h, i, b, e, j, k