问题
How many binary tree shapes of N nodes are there with height N-1? Also, how would you go about proofing by induction?
So binary tree of height n-1 with node n means all node will have only 1 child, sort of chain like structure? So number of binary tree will be different permutation of n numbers which is n. Am I thinking in the right direction?
回答1:
You are thinking in the right direction and you have correctly transformed the original problem to a simple one. However what is strange is that it is explicitly stated that the tree is "binary" when in fact the statement dictates even tighter constraint.
来源:https://stackoverflow.com/questions/32397904/number-of-binary-tree-shapes-of-n-nodes-are-there-with-height-n-1