We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://oi-wiki.org/ds/leftist-tree/#%E5%88%A0%E9%99%A4%E4%BB%BB%E6%84%8F%E8%8A%82%E7%82%B9
实现是否应改为: ???+ note "实现" ```cpp int& rs(int x) { return t[x].ch[t[t[x].ch[1]].d < t[t[x].ch[0]].d]; }
// 有了 pushup,直接 merge 左右儿子就实现了删除节点并保持左偏性质 int merge(int x, int y) { if (!x || !y) return x | y; if (t[x].val < t[y].val) swap(x, y); t[rs(x) = merge(rs(x), y)].fa = x; t[x].d = t[rs(x)].d + 1; return x; } void pushup(int x) { if (!x) return; if (t[x].d != t[rs(x)].d + 1) { t[x].d = t[rs(x)].d + 1; pushup(t[x].fa); } } void erase(int x) { if (!x) return; x = merge(t[x].ch[0], t[x].ch[1]); pushup(x); } ```
否则时间复杂度是O(log^2n)的
The text was updated successfully, but these errors were encountered:
感谢你对 OI Wiki 的关注!记得在 Issue 中表达清楚自己的意思哦~
Sorry, something went wrong.
No branches or pull requests
请选择:
我正在访问这个页面
https://oi-wiki.org/ds/leftist-tree/#%E5%88%A0%E9%99%A4%E4%BB%BB%E6%84%8F%E8%8A%82%E7%82%B9
我发现页面有这样的问题
实现是否应改为:
???+ note "实现"
```cpp
int& rs(int x) { return t[x].ch[t[t[x].ch[1]].d < t[t[x].ch[0]].d]; }
否则时间复杂度是O(log^2n)的
The text was updated successfully, but these errors were encountered: