MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / RInsert

Function RInsert

Trees/BST.C:70–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70struct 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
87int Height(struct Node *p)
88{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected