Binary search tree methods I have implemented a binary search tree with the methods search, insert, and delete. I want to know if this is the best way to code them or if there are any other way by which I can reduce the code size or redundancies in code, if any.

#include &lt;bits/stdc++.h&gt;
using namespace std;

struct node{
    int val;
    node* left;
    node* right;
    node(){
        left=right=NULL;
    };
    node(int val){
        this-&gt;val = val;
        left=right=NULL;
    }
};

struct bTree{
    node* root;
    void insert(int val);
    node* search(int val);
    void deleteVal(int val);
    node* getParent(int val);
    bTree(){
        root = NULL;
    }
    bTree(int val){
        root = new node(val);
    }
};

void bTree::insert(int val){
    if(!root){
        root = new node(val);
        return;
    }
    node* temp = root;
    node* parent = root;
    while(temp){
        parent = temp;
        if(val &gt;= temp-&gt;val){temp = temp-&gt;right;}
        else{ temp = temp-&gt;left;} 
    }
    if(val &gt;= parent-&gt;val){parent-&gt;right = new node(val);}
    else{parent-&gt;left = new node(val);}
    return;
}

node* bTree::search(int val){
    node* temp = root;
    while(temp &amp;&amp; (temp-&gt;val!=val)){
        if(val &gt; temp-&gt;val){temp = temp-&gt;right;}
        else if(val &lt; temp-&gt;val){temp = temp-&gt; left;}
    }
    return temp;
}

node* bTree::getParent(int val){
    if(!root || (root-&gt;val == val)){return NULL;}
    node* temp = root;
    node* parent = NULL;
    while(temp){
        if(temp-&gt;val == val) return parent;
        if(val &lt; temp-&gt;val) {parent = temp; temp= temp-&gt;left;}
        if(val &gt; temp-&gt;val) {parent = temp; temp= temp-&gt;right;}
    }
    return NULL;
}


void bTree::deleteVal(int val){
    node* temp = search(val);
    if(!temp){return;}
    if(!(temp-&gt;left) &amp;&amp; !(temp-&gt;right)){
        if(temp==root){
            root = NULL;
            delete temp;
        }
        else{
            node* parent = getParent(val);
            if(parent-&gt;right==temp){parent-&gt;right=NULL; delete temp;}
            else{parent-&gt;left=NULL; delete temp;}
        }
    }
    else if(!(temp-&gt;left) &amp;&amp; (temp-&gt;right)){
        if(temp==root){
            root = root-&gt;right;
            delete temp;
        }
        else{
            node* parent = getParent(val);
            if(parent-&gt;right==temp){parent-&gt;right=temp-&gt;right; delete temp;}
            else{parent-&gt;left = temp-&gt;right; delete temp;}
        }
    }
    else if((temp-&gt;left) &amp;&amp; !(temp-&gt;right)){
        if(temp==root){
            root = root-&gt;left;
            delete temp;
        }
        else{
            node* parent = getParent(val);
            if(parent-&gt;right==temp){parent-&gt;right = temp-&gt;left; delete temp;}
            else{parent-&gt;left = temp-&gt;left; delete temp;}
        }
    }
    else{
        node* minNode =temp-&gt;right;
        while(minNode-&gt;left){
            minNode = minNode-&gt;left;
        }
        int valStoring = minNode-&gt;val;
        deleteVal(minNode-&gt;val);
        temp-&gt;val = valStoring;
    }
    return;
}

int main(){
    bTree a;
}
Namespace
#include &lt;bits/stdc++.h&gt;
using namespace std;

The first line supposedly inserts all includes your code needs but haven't specifically included. The second line saves you a lot of typing by not having to insert std:: in front of all relevant methods and types.
Please don't use those!
Read Why is “using namespace std;” considered bad practice? on Stack Overflow for the full read, but the short version is it's a major maintainability risk and allows function conflicts to arise.
The first line combined with the second line makes it even worse, since now you are no longer in control about how your code executes. You should tell the compiler what to do, not the other way around.
You current style not only hurts maintainability, it also hurts your understanding of how the language works. Practices like these lead to programmers not understanding how to make the best of namespaces.
Style
left=right=NULL;`

This hurts readability and maintainability. It's clear you're setting something to NULL, but not why. You're probably resetting something. However, you're resetting both left and right at the same time, on the same line. If you need to reset multiple things at the same time, you usually implement a function doing so.
if(val &lt; temp-&gt;val) {parent = temp; temp= temp-&gt;left;}`

All your if statements look like that. The more accepted (and more readable) style of bracketing in C++ goes like this:
if(val &lt; temp-&gt;val)
{
    parent = temp;
    temp= temp-&gt;left;
}

Don't be afraid of using newlines.
int main(){
    bTree a;
}

You declare a bTree named a. You're not doing anything with it, just creating something. If you would do something with it, you'd notice a isn't a good name for a bTree. a.insert(val) doesn't tell me anything, except you're inserting something into a. In a bigger project, you'll encounter more variable names and all those names should be descriptive.
Finally:
The size of code in C++ is usually irrelevant. Space is cheap nowadays and saving a couple of bytes in the source won't bring you anywhere with compiled languages. Only the size of the resulting binary may be relevant, especially if you're working on embedded systems.