C language is evaluated as the level of x nodes in the binary tree

If there is a parameter used as the current node depth in the function’s independent variable, as in the example:

Using recursive invocation, the general idea to solve the problem is as follows:

If the function does not have a parameter that can be used as the depth of the current node, then you can define one.

Lever =num1>num2 Num1: num2;

To summarize, the recursive idea of the problem can also be thought of as follows:

Normally, we think of hierarchies as the number of layers from the top down, but here it’s the number of layers from the bottom up, like the tree below

     a           3
        b        2
     c           1
  d     e
  
Copy the code

If the node we’re looking for is C, the hierarchy of C is n=1, all the way up to B: n=2, to A: n=3

Thank you for watching!