home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 322_01 / btree.h < prev    next >
C/C++ Source or Header  |  1990-08-06  |  854b  |  54 lines

  1. #include <stdio.h>
  2.  
  3.  
  4.         /*
  5.          *    Global structures and definitions
  6.          */
  7.  
  8.  
  9. #define TRUE    1
  10. #define FALSE    0
  11.  
  12.         /*
  13.          *    Declare the type of the KEY
  14.          */
  15.  
  16. typedef char * KEY;    /* Key = addr returned from malloc */
  17.  
  18.  
  19.         /*
  20.          *    ... ditto for the INFO field
  21.          */
  22.  
  23. typedef struct {
  24.     int MalCallNum;    /* malloc call number */
  25.     int MalSize;    /* malloc'd size */
  26.     char * MalAddr;    /* malloc'd address */
  27.     struct list *lp;
  28. } INFO;
  29.  
  30. typedef struct Datum {
  31.     KEY    key;
  32.     INFO    inf;
  33. } DATUM;
  34.  
  35.         /*
  36.          *    This is the definition of
  37.          *    the nodes of the B-Tree
  38.          */
  39.  
  40. #define    M    2
  41. typedef struct btnode {
  42.     int            t_active;        /* # of active keys */
  43.     DATUM            t_dat  [2 * M];        /* Keys  + Data */
  44.     struct btnode        *t_ptr [2 * M + 1];    /* Subtree ptrs */
  45. } NODE, *BTREE;
  46.  
  47. BTREE Insert();
  48.  
  49. BTREE Delete();
  50.  
  51. DATUM *Search();
  52.  
  53. int Apply();
  54.