I am having trouble writing an insert function for a binary tree.

Here is the structure that I have to use.

I have the print function done, the insert function is the one I am having trouble with, thanks a lot.

Code:typedef struct bt_{ int value; struct bt_ *right; struct bt_ *left; }BST; BST* insert(BST* root, int value); /*This function will insert a new node with a value of value in BST. Remember, in this program a binary tree is defined either being null or it is a node whose left subtree is filled with nodes whose values are less than its own, and a right subtree whose right subtree is filled with nodes whose values are greater than or equal to its own. Although not required, it is recommended that you try and implement this function recursively. */ void printTree(BST* root) { displayBST(root, 0); } void displayBST(BST* root, int depth) { if (root == NULL) { padding(' ', depth); printf("-\n"); return; } displayBST(root->left, depth+4); padding(' ', depth); printf("%d\n", root->value); displayBST(root->right, depth+4); } void padding(char toPrint, int numTimes) { int i; for (i = 0; i < numTimes; i++) printf("%c", toPrint); }

Thanks for your help!