type
quadrant = (NW, NE, SW, SE);
nameptr = ^name_t; { Name pointer type }
name_t = record { Name record }
DATA : char;
NEXT : nameptr;
end;
nodeptr = ^node; { Quadtree node pointer }
node = record
XCOORD,
YCOORD : integer; { Point coordinates }
NAME : name_t; { Name }
{ Four sons of current node }
SON : array [NW..SE] of nodeptr;
{ Left and right links used as binary serach tree }
LLINK,
RLINK : nodeptr;
end;
#define NRDIRS 4
typedef char * nameptr;
typedef enum {NW, NE, SW, SE} quadrant;
typedef struct node_s {
int XCOORD; /* X coordinate */
int YCOORD; /* Y coordinate */
nameptr NAME; /* Name */
struct node_s * SON[NRDIRS]; /* Four sons in quadtree */
/* Left and Right links in binary search tree */
struct node_s * LLINK, * RLINK;
} node;
typedef node * nodeptr;
nodeptr quadtree; /* Declare a quadtree */
nodeptr bstree; /* Declare a binary search tree */
#define NRDIRS 4
typedef char * nameptr;
typedef enum {NW, NE, SW, SE} quadrant;
class node {
public:
int XCOORD; // X coordinate
int YCOORD; // Y coordinate
nameptr NAME; // Name
node * SON[NRDIRS]; // Four sons in quadtree
node * LLINK, * RLINK; // Left and Right links for binary search
};
node * quadtree; // Declare a quadtree
node * bstree; // Declare a binary search tree