With pattern:
if(node == NULL){
// do something
}
left = do_something(root->left)
right = do_something(root->right)
do_something with root, left, right
we can get that, left and right return its depth and the deepest node’s parents
Error:
- do not know the meaning of function and its return, with function depth(root), we return current depth of subtree, and the deepest node in the pair structure.