Create tree to bst