continue to implement the function for binary tree