Learn basic concept of c , c++ and python programming in regularcodes.com

# Insertion of binary search tree(BST)

Binary search tree (BST) it follow following property.

1) root node are top of the tree. There are first inserted node of tree.

2) if inserting newly node of tree and its value are lesser of root node. Then it will put on left side of root node. Its called left subtree.

3) if inserting new node of tree and that value is greater of root node. Then it will put on right side of root node.

suppose following data [504, 485, 528, 450, 527, 576, 428, 574, 438, 535] are inserting on tree.
inserting first node **[504]** of bst.

Insertion another node **[485].**

Insertion another node **[528].**

Insertion another node **[450].**

Insertion another node **[527].**

Insertion another node **[576].**

Insertion another node **[428].**

Insertion another node **[574].**

Insertion another node **[438].**

Insertion another node **[535].**

**Algorithm:**

Time complexity of this program O(n)

**Code execution:**

In this execution process not imagination all steps. below link click and view how to insert bst node, how to show all bst node.

C program to insert binary search tree element. Iterative approach.

Inorder BST data : 428 438 450 485 504 527 528 535 576 578

View comments and participate Discussion