请教一道程序设计大赛的题目

来源:百度知道 编辑:UC知道 时间:2024/05/29 01:53:15
原题如下:
We can number binary trees using the following scheme:
The empty tree is numbered 0.
The single-node tree is numbered 1.
All binary trees having m nodes have numbers less than all those having m+1 nodes.
Any binary tree having m nodes with left and right subtrees L and R is numbered n such that all trees having m nodes numbered > n have either
Left subtrees numbered higher than L, or
A left subtree = L and a right subtree numbered higher than R.

Your job for this problem is to output a binary tree when given its order number.

而对于下面这句不能理解,请高手指教.
Any binary tree having m nodes with left and right subtrees L and R is numbered n such that all trees having m nodes numbered > n have either
Left subtrees numbered higher than L, or
A left subtree = L and a right subtree numbered higher than R.

标记为n的二叉树有左右子树L和R,那么标记大于n的二叉树要么左子树的标记比L大,要么左子树标记等于L,右子树比R大。
就是说,不可能出现左子树标记小于L而右子树大于R加起来节点比n多的情况,标记就是节点数啦。

你就给20分 谁有空给你做