0001 template <typename T> Rank BinNode<T>::updateHeight() { //更新节点高度 0002 return height = color + max( stature( lc ), stature( rc ) ); //孩子黑高度通常相等,除非出现双黑 0003 } 0004 0005 template <typename T> void BinNode<T>::updateHeightAbove() //更新当前节点及其祖先的高度 0006 { for ( BinNodePosi<T> x = this; x; x = x->parent ) x->updateHeight(); } //可优化