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

Function insert

CPP/BST/InsertionInABST.cpp:41–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 return 0;
40}
41struct node *insert(struct node *node, int key) {
42 if(search(node,key)==0){
43
44 if (node == NULL){
45 return createnode(key);
46 }
47 if (key < node->data){
48 node->left = insert(node->left, key);
49 }
50 else{
51 node->right = insert(node->right, key);
52 }
53 }
54
55 return node;
56}
57
58
59int main() {

Callers 1

mainFunction · 0.70

Calls 2

createnodeFunction · 0.85
searchFunction · 0.70

Tested by

no test coverage detected