这两种写法为什么第一种是对的,第二种就会炸?
(就是那个f=fa[x]的位置)
①
inline void splay(int x){
for(int f;f=fa[x];rotate(x))
if(fa[f]){
if(get_son(x)==get_son(f))
rotate(f);
else rotate(x);
}
root=x;
}
②
inline void splay(int x){
for(int f;f;rotate(x)){
f=fa[x];
if(fa[f]){
if(get_son(x)==get_son(f))
rotate(f);
else rotate(x);
}
}
root=x;
}