Tree/Binary Search Tree/BST Implementation.cpp
// Recursive function to Insert a node into BT
Recursive function to Insert a node into BT
Recursive function to Insert a node into BT
struct node *insertNode(struct node *node, int value)
{
    if (node == NULL) return createNode(value);
    if (value < node->data)
        node->left = insertNode(node->left, value);
    else
        node->right = insertNode(node->right, value);
    return node;
}
struct node * insertNode ( struct node * node , int value ) { if ( node == NULL ) return createNode ( value ) ; if ( value < node -> data ) node -> left = insertNode ( node -> left , value ) ; else node -> right = insertNode ( node -> right , value ) ; return node ; }
Recursive function to Insert a node into BT
Recursive function to Insert a node into BT
// Return a new node if the tree is empty // Traverse to the right place and insert the node