BST
BST
• struct node{
int data;
struct node* left;
struct node* right;};
struct node* createNode(value)
newNode -> data = value;
newNode -> left = NULL;
newNode -> right = NULL;
return newNode;
Algorithm to insert in bst
struct node* insert(struct node* root, int data){
if (root == NULL)
return createNode(data);
if (data < root -> data)
root -> left = insert(root -> left, data);
else if (data > root -> data)
root -> right = insert(root -> right, data);
return root;
}