摘要:
(1)通过画图分析可知,最小AVL树是一种递归生成的结构,具有高度h的最小树由H-1和h-2的树作为左右子树加一个根节点构成;
Position GenTree( int Height, int *LastNode )
{
Position T;
if( Height >= 0 )
{
T = (Position)malloc( sizeof( *T ) );
T->Left = GenTree( Height - 1, LastNode );
T->Element = ++*LastNode;
T->Rgiht = GenTree( Height - 2, LastNode );
return T;
}
else
return NULL;
}