Get the right recursive algorithm

The others, like the tree traversing method, iterative method are all in stuck.