#include #include #include typedef struct Node { char Name[80], Phone[80], Email[80]; struct Node* leftChild; struct Node* rightChild; struct Node* parent; }Node; Node* root; Node* makeNode(char *s1, char* s2, char* s3) { Node*p = (Node*)malloc(sizeof(Node)); strcpy(p->Name,s1); strcpy(p->Phone,s2); strcpy(p->Email,s3); p->parent = NULL; p->leftChild = NULL; p->rightChild = NULL; return p; } void addNode(Node*p) { if(root == NULL) { root = p; return; } Node*q = root; int cmp; while(1) { if(q == NULL) { q = p; return; } cmp = strcmp(q->Name,p->Name) switch(cmp) { case 0: return; case -1: q = q->rightChild; break; case 1: q = q->leftChild; break; } } }