
平衡树
巴扎嘿呀
学习知识图谱中~欢迎交流
展开
-
平衡树(旋转)
#include<bits/stdc++.h>using namespace std;struct node{ int val; node* left; node* right;};node* rotater(node* root){ node* t=root->left; root->left=t->right; t->right=root; return t;}node* rotatel(node* root){ node* t=root-原创 2021-09-18 22:09:45 · 134 阅读 · 0 评论 -
替罪羊树(模板)
#include <cstdio>#include <cstdlib>#include <cstring> //除了重构的其他操作为log(n),重构nlog(n) //zuo,you:记录该节点的左右儿子//x:该节点的值//tot:有多少个值为x的数//size,trsize,whsize:size表示以该节点为根的子树内有多少个节点,trsize表示有多少个有效节点(这个后面再讲啦),whsize表示有多少个数(也就是子树内所有节点的tot的和)/.原创 2020-09-24 09:12:42 · 126 阅读 · 0 评论