0001 template <typename T> Rank BinTree<T>::updateHeight( BinNodePosi<T> x ) //更新节点x高度 0002 { return x->height = 1 + max( stature( x->lc ), stature( x->rc ) ); } //具体规则,因树而异 0003 0004 template <typename T> void BinTree<T>::updateHeightAbove( BinNodePosi<T> x ) //更新高度 0005 { while ( x ) { updateHeight( x ); x = x->parent; } } //从x出发,覆盖历代祖先。可优化