| 68 | } |
| 69 | |
| 70 | struct Node *RInsert(struct Node *p, int key) |
| 71 | { |
| 72 | struct Node *t = NULL; |
| 73 | if (p == NULL) |
| 74 | { |
| 75 | t = (struct Node *)malloc(sizeof(struct Node)); |
| 76 | t->data = key; |
| 77 | t->lchild = t->rchild = NULL; |
| 78 | return t; |
| 79 | } |
| 80 | if (key < p->data) |
| 81 | p->lchild = RInsert(p->lchild, key); |
| 82 | else if (key > p->data) |
| 83 | p->rchild = RInsert(p->rchild, key); |
| 84 | return p; |
| 85 | } |
| 86 | |
| 87 | int Height(struct Node *p) |
| 88 | { |