帰納法を使用して二分木のプロパティを証明するのに問題があります。
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
私のセットアップは正しいですか?もしそうなら、どうすればこれらのものを実際に見せることができるでしょうか。私が試したことはすべて、結局めちゃくちゃになりました。助けてくれてありがとう