![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构:Splay Tree
skajre
这个作者很懒,什么都没留下…
展开
-
splay树
#include struct Node{ Node* ch[2]; int s,v,r; Node(int v): v(v) {ch[0]=ch[1]=NULL;r=rand();s=1;} int cmp(int x) const { if(x==s-ch[1]->s) return -1; return xs?0:1;原创 2016-10-29 09:47:03 · 158 阅读 · 0 评论 -
UVA 11922 Permutation Transformer(splay树)
#include #include #include #include using namespace std; struct Node{ Node* ch[2]; int v,s; int flip; int cmp(int x) const { int d=x-ch[0]->s; if(d==1) return -1;原创 2016-10-30 10:14:23 · 194 阅读 · 0 评论