next up previous
Nächste Seite: Pre-, In-, Post-Order Aufwärts: Datenstrukturen Vorherige Seite: Kellerspeicher (Stacks)

Baum-Durchquerungen

Beispiel: Ausgabe von Operator-Ausdrücken:

void print (Knoten t) {
  if t ist Blatt { print (t.key); }
  else { print ( t.left );
         print ( t.key );
         print ( t.right );
       }              }

Beispiel: Auswertung von Operator-Ausdrücken:

int wert (Knoten t) {
  if t ist Blatt { return t.eintrag; }
  else { int l = wert ( t.links );
         int r = wert ( t.rechts );
         return (l `t.key' r);
       }            }



Johannes Waldmann 2004-01-30