home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8707 / 39 / btree.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-13  |  798 b   |  51 lines

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