ALGORITHM LeafCounter(BTNode node)
// Computers recursively the number of leaves in a binary tree
// Input: Root node of a binary (sub-)tree 1/
// Output: The number of leaves in the tree rooted by input node
if (node == null) return 0;
else
return LeafCounter(node.getLeftChild 0 ) + Leaf Counter(node.getRightChild();
我不确定如何编辑它,以便准确计算叶子?此外,如果您能提供失败原因的证据,这对我来说将非常有帮助,看起来它应该可以工作