Binary Search Tree implementation in C++
<pre><code>#include &lt;iostream&gt;
using namespace std;

class Node{
    public:
        int data;
        Node* left_child;
        Node* right_child;
        Node(int x){
            data = x;
            left_child = NULL;
            right_child = NULL;
        }
};

class BST{
    public:
    //Initially root is null
    Node* root = NULL;

    void insert(Node* node, int data){
        if(node == NULL){
            node = new Node(data);
            return;
        }
        if(data &lt; node-&gt;data){
            insert(node-&gt;left_child,data);
        }
        else if(data &gt; node-&gt;data){
            insert(node-&gt;right_child,data);
        }

    }
    void just_insert(int data){
        insert(root,data);
    }
    void print(Node* node){
        if(node == NULL){
            return;
        }
        cout&lt;&lt;node-&gt;data&lt;&lt;" ";
        print(node-&gt;left_child);
        print(node-&gt;right_child);
    }
    void just_print(){
        print(root);
    }
};

int main() {
    //For fast IO
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,x;
    cin&gt;&gt;n;
    BST bst = BST();
    for(int i=0; i&lt;n; i++){
        cin&gt;&gt;x;
        bst.just_insert(x);
    }
    bst.just_print();
    return 0;
}
</code></pre>

<p>What is wrong with this implementation of BST ? I am giving 8 values as input:
8
3
5
1
6
8
7
2
4
But when I invoke the print function. I do not get any output.
Am I missing out on some pointer logic ? The insert function goes recursively down the tree, to find a place to insert the value
The print function also works recursively.</p>