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
There is a distinguished node n , called the "root".
(child(n)) {n }N
child(n )
The set of nodes with child(n) is called the set of "leaves".
We will use the notation N for the set of nodes and the tree interchangeably. We will use N
to denote the subtree with root n
Using array notation, child(n) n[i] 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 );
}
}
The ordered walk
r, a, c, f, g, d, h, i, b, e, j, k