How should a new node with the same value be inserted?

Nov 26, 2012 at 12:55 AM

Say a tree has an existing node with value 1. If another node of same value is to be added , which side should it go?

Your document states to go RIGHT :  " where the left subtree of x  contains nodes with values < x and the right subtree contains nodes whose values are >= x ."

Whereas an article from Stanford states to go LEFT : "all elements in its left subtree are less-or-equal to the node (<=), and all the elements in its right subtree are greater than the node (>)."

Provided code sample ignores duplicates.  I am not sure which side to take?