GadTD @ 2017-12-06 14:43:57
inline void Splay(int x,int goal)
{
while(t[x].ff!=goal)
{
int y=t[x].ff;int z=t[y].ff;
if(z!=goal)
(t[z].ch[1]==y)^(t[y].ch[1]==x)?rotate(x):rotate(y);
rotate(x);
}
if(goal==0)root=x;
}
by GadTD @ 2017-12-06 14:53:24
(t[z].ch[1]==y)^(t[y].ch[1]==x)?rotate(x):rotate(y);
这句看不懂
by λᴉʍ @ 2017-12-06 15:00:48
没问题啊。。。
by ezoixx118 @ 2017-12-06 17:00:07
仔细模拟一下就会了
by ezoixx118 @ 2017-12-06 17:01:25
用来判断是zig还是zag