Generally the tree have one root node and child node, each child node can have leaf nodes.
How elements will insert in a tree ?
Assume your going to insert a element 10 in the tree.
As there are no elements it will insert as root node.
Then again if we try to insert element 20, it will insert right side of tree because 20 is greater then 10.
What if element is less then 10 ? - It goes to left side of tree.
Finally the tree will look like this.
How elements will insert in a tree ?
Assume your going to insert a element 10 in the tree.
As there are no elements it will insert as root node.
Then again if we try to insert element 20, it will insert right side of tree because 20 is greater then 10.
What if element is less then 10 ? - It goes to left side of tree.
Finally the tree will look like this.
