void Insert(Node * &o,int x){//0为左子树,1为右子树 if(o==NULL){o = new Node(); o->ch[0]=o->ch[1]=NULL;o->key=x;o->weight=rand();} else{ int d=o->cmp(x); Insert(o->ch[d],x); if(o->ch[d]->weight>o->weight) rotate(o,d^1); } }