Suchen im sortieren binären Baum

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]

SortedBinaryTrees.om
PROCEDURE Lookup(tree: Tree; key: Objects.Object;
                 VAR object: Objects.Object) : BOOLEAN;
   (* precondition: key must be comparable for tree;
      stores into object that object of the tree
         that is identical to key if present;
      returns TRUE if one object has been found
   *)
   VAR
      parent, node: Node;
BEGIN
   ASSERT(tree.comparable(key));
   IF Find(tree, key, parent, node) THEN
      object := node.object;
      RETURN TRUE
   ELSE
      RETURN FALSE
   END;
END Lookup;

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]
Copyright © 1999 Andreas Borchert, in HTML konvertiert am 29.06.1999