0001 template <typename T> BNP<T> BinNode<T>::zig() { //˳ʱÕëÐýת 0002 BNP<T> v = lc; if (!v) return this; 0003 v->parent = parent; 0004 if (parent) (IsLChild(this) ? v->parent->lc : v->parent->rc) = v; 0005 lc = v->rc; if (lc) lc->parent = this; 0006 v->rc = this; parent = v; 0007 updateHeight(); v->updateHeight(); if (v->parent) v->parent->updateHeight(); 0008 return v; 0009 } //zig