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

Function Insert

CPP/Trees/BinarySearchTree.cpp:21–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19}
20
21BSTNode* Insert(BSTNode* root, int data) //BST** root
22{
23 if(root == NULL) //*root
24 {
25 root = GetNewNode(data); //*root
26 }
27 else if(data <= root -> data)
28 {
29 root -> left = Insert(root -> left, data); //insert data in left subtree
30 }
31 else
32 {
33 root -> right = Insert(root -> right, data);
34 }
35 return root;
36}
37
38bool Search(BSTNode* root, int data)
39{

Callers 1

mainFunction · 0.70

Calls 1

GetNewNodeFunction · 0.85

Tested by

no test coverage detected