home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 347_01 / tavlpriv.h < prev    next >
C/C++ Source or Header  |  1991-10-01  |  2KB  |  52 lines

  1. #if !defined TAVLPRIV_H
  2. #define TAVLPRIV_H
  3.  
  4. /*:file:version:date: "%n    V.%v;  %f"
  5.  * "TAVLPRIV.H    V.8;  1-Oct-91,20:16:32"
  6.  *
  7.  *  module: TAVLPRIV.H
  8.  *  author: Bert C. Hughes
  9.  *  purpose: Internal stuff for TAVLtree library functions.
  10.  *           None of the definitions or prototypes in this header
  11.  *           are for "public" use - this header is for the private
  12.  *           use of the TAVL library only. This header must be present
  13.  *           when the TAVL library functions are compiled, but "tavlpriv.h"
  14.  *           never needs to be included in any application.
  15.  *
  16.  *  Released to the PUBLIC DOMAIN
  17.  *
  18.  *                      Bert C. Hughes
  19.  *                      200 N. Saratoga
  20.  *                      St.Paul, MN 55104
  21.  *                      Compuserve 71211,577
  22.  *
  23.  */
  24.  
  25. #include "tavltree.h"     /* for typedef of "TAVL_nodeptr" & "NULL" */
  26.  
  27. #define RIGHT   -1
  28. #define LEFT    +1
  29. #define THREAD  0
  30. #define LINK    1
  31. #define LLINK(x)    ((x)->Lbit)
  32. #define RLINK(x)    ((x)->Rbit)
  33. #define LTHREAD(x)  (!LLINK(x))
  34. #define RTHREAD(x)  (!RLINK(x))
  35. #define Leftchild(x)    (LLINK(x) ? (x)->Lptr : NULL)
  36. #define Rightchild(x)   (RLINK(x) ? (x)->Rptr : NULL)
  37. #define Is_Head(x)      ((x)->Rptr == (x))
  38.                             /* always true for head node of initialized */
  39.                             /* tavl_tree, and false for all other nodes */
  40.  
  41. #define RECUR_STACK_SIZE 40  /* this is extremely enormous */
  42.  
  43. TAVL_nodeptr rebalance_tavl(TAVL_nodeptr a, char *deltaht);
  44. /*  Returns pointer to root of rebalanced tree "a".  If rebalance reduces
  45.     the height of tree "a", *deltaht = 1, otherwise *deltaht = 0.
  46.     "rebalance_tavl" is called ONLY by "tavl_insert" and "tavl_delete".
  47.     *deltaht is always 1 when "rebalance_tavl" is called by "tavl_insert";
  48.     however, *deltaht may return 1 or 0 when called by "tavl_delete".
  49. */
  50.  
  51. #endif
  52.