我在使用归纳法证明二叉树属性时遇到了麻烦:
Property 1 - A tree with N internal nodes has a maximum height of N+1
base case - 0 internal nodes has a height of 0
assume - a tree with k internal nodes has a maximum height of k+1 where k exists in n
show - true for all k+1 or true for all k-1
Property 2 - A tree with a tree with N internal nodes has N + 1 leaf nodes
base case - 0 internal nodes has 1 leaf node (null)
assume - a tree with k internal nodes has k + 1 leaf nodes where k exists in n
show - true for all k+1 or true for all k-1
我的设置正确吗?如果是这样,我该如何展示这些东西。我所尝试的一切最终都变得一团糟。谢谢您的帮助