add a parameter root to decide if the node is Root