home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / modu1096.zip / GPMsym / cardtrees.def < prev    next >
Text File  |  1996-08-29  |  2KB  |  40 lines

  1. (****************************************************************)
  2. (*                                                              *)
  3. (*         Gardens Point Modula-2 Library Definition            *)
  4. (*                                                              *)
  5. (*                                                              *)
  6. (*     (c) Copyright 1992 Faculty of Information Technology     *)
  7. (*              Queensland University of Technology             *)
  8. (*                                                              *)
  9. (*     Permission is granted to use, copy and change this       *)
  10. (*     program as long as the copyright message is left intact  *)
  11. (*                                                              *)
  12. (****************************************************************)
  13.  
  14. DEFINITION MODULE CardTrees;
  15.   FROM CardSequences IMPORT Sequence;
  16.  
  17.   TYPE Tree; (* pointer to root, or NIL for empty tree *)
  18.  
  19.   PROCEDURE InitTree(VAR tre : Tree);
  20.   (* postcondition : tre is an empty tree *)
  21.  
  22.   PROCEDURE IsEmpty(tre : Tree) : BOOLEAN;
  23.   (* postcondition : returns "tre is the empty Tree" *)
  24.  
  25.   PROCEDURE Insert(VAR tre : Tree; element : CARDINAL);
  26.   (* precondition : tre is a valid tree, possibly empty   *)
  27.   (* postcondition: element is in tree & tree is ordered  *)
  28.  
  29.   PROCEDURE Delete(VAR tre : Tree; element : CARDINAL);
  30.   (* precondition : tre is a valid ordered tree, or empty *)
  31.   (* postcondition: element not in tree, tree still valid *)
  32.  
  33.   PROCEDURE Lookup(tre : Tree; element : CARDINAL) : BOOLEAN;
  34.   (* precondition : tre is a valid ordered tree, or empty *)
  35.  
  36.   PROCEDURE MakeSequence(tre : Tree; VAR seq : Sequence);
  37.   (* postcondition : seq has preorder contents of tre *)
  38.  
  39. END CardTrees.
  40.