Need algorithm to add Node in binary tree
- by m.qayyum
•if your new element is less or equal than the current node, you go to the left subtree, otherwise to the right subtree and continue traversing
•if you arrived at a node, where you can not go any deeper, because there is no subtree, this is the place to insert your new element
(5)Root
(3)-------^--------(7)
(2)---^----(5) ^-----(8)
(5)--^
i want to add this last node with data 5...but i can't figure it out...I need a algorithm to do that
or in java language