第1个回答 推荐于2019-10-18
public static<T> int numOfLeavesInRecursion(BinaryTreeNode<T> root){ // 获取二叉树叶子节点的个数的递归算法
if(root == null)
return 0;
if(root.getLeft() == null && root.getRight() == null)
return 1;
return numOfLeavesInRecursion(root.getLeft())+
numOfLeavesInRecursion(root.getRight());
}本回答被网友采纳