If the node has only one child, then the parent of the node is made to point to the child of the node and the node is freed.
If the node has no left and right children, then the pointer to that node from the parent is changed to NULL and the node is freed of its memory.
Find the node where the element resides.
If the element is already present in the tree, do nothing.
Otherwise if the element to be inserted is more than the root element T, repeat the step 3 recursively, with the new value of T as T->Right.
Otherwise if the element to be inserted is less than the root element T, repeat the step 3 recursively, with the new value of T as T->Left.
If the value of T is NULL, assign T->Element to X, and the left and right child pointers to NULL and exit the insertion operation.
To insert a new element X into the tree:.
Create a new node using malloc function and assign the resultant pointer variable to the root node pointer T and assign it to NULL.
Create a structure with an element (Element) and two pointers – Left and Right that points to the left and right child node respectively in the tree.
Root node will be pointed to by a pointer variable. A leaf node has a leftChild and rightChild link of NULL. Each connecting line (or edge) in a binary tree drawing will be represented by a link field. In the linked list implementation of binary search trees: Each element is represented by node with two link fields and a data field.