【发布时间】:2014-02-19 19:58:49
【问题描述】:
我有这两个功能:
// Return the smallest number
public static int min (int a, int b) { ... }
// Return is the Node is Leaf
public static boolean isLeaf (Node t) { ... }
这个函数有什么作用:
public static int f (Node t)
{
if (t == null)
return 0;
return 1 + min (f (t.getLeftSon()),f (t.getRightSon()));
}
【问题讨论】:
-
你认为它有什么作用?在家工作?对我来说,它看起来像是最低的子树高度。
-
尝试画一棵树,看看这个递归方法的行为和作用。
-
我已经尝试过了,但是递归非常混乱
标签: java function recursion tree