iterative insertion instead of recursive insertion for the tree structure