How to handle duplicate in BST

Mujahida Joynab - Feb 14 - - Dev Community

In BST , Left node values are less the than root node and right node values are greater than the root node .

So , What will happen if the value is equal to the root node?

The equal values can not be inserted in BST . Because it will create a problem in BST . We will just count root node 2 times using pair .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .