0001 //通过zig旋转调整,将BST子树x拉伸成最右侧通路 0002 template <typename T> void stretchByZig ( BinNodePosi(T) & x ) { 0003 BinNodePosi(T) v = x; 0004 while ( x->lc ) x = x->lc; 0005 for ( ; v; v = v->rc ) { 0006 while ( v->lc ) 0007 v = v->zig(); 0008 } 0009 }