Part 4 of 15 in Binary Search Trees  

Insert node in a binary search tree by animeshn

Problem statement

Write a function to insert a Node in a binary search tree. A binary search tree is a binary tree in which value of all the nodes left of a node are lesser than it and value of all the nodes right of node are greater than it.

Input

You need to write a function named "InsertNodeInBST" that will take root of a binary search tree as argument.

Output

Your function must return pointer to root after insertion.



To try out your code



Sign in

Sign up