
动态树
nuaalida
这个作者很懒,什么都没留下…
展开
-
splay树解决NOI的郁闷的出纳员
#include #include #include using namespace std; struct node { int money, delta; int sum,ld,rd; node *lch,*rch,*fa; int calc_tot(){ return (this==NULL ? 0:ld+rd+原创 2013-07-27 18:49:31 · 610 阅读 · 0 评论 -
Splay树的基本写法
//node为节点类型,其中ch[0]表示左结点指针,ch[1]表示右节点指针 //pre表示指向父亲的指针 void Rotate(node *x,int c) //旋转操作,c=0表示左旋,c=1表示右旋 { node *y= x->pre; Push_Down(y), Push_Down(x); //先将Y节点的标记乡下传递(因为Y在上面),再把X的标记向下传递原创 2013-08-11 17:19:50 · 548 阅读 · 0 评论