Splay整理

伸展树(Splay Tree),也叫分裂树,是一种二叉排序树,它能在O(log n)内完成插入、查找和删除操作。(来自百科)

 

伸展树的操作主要是

 

 

 基本操作整理

 

void rotate(int x,int &k);
void splay(int x,int &k);
void build(int l,int r,int f);
//=================================// 
void Insert(int x,int root);//插入 
void Delete(int x,int root);//删除 
void Modify(int x,int val);//修改 
void Rever(int x,int root);//翻转 
bool Exist(int x,int root);//检查是否存在x 
int Find_min(int root);//最小值 
int Find_max(int root);//最大值 
int Find_prev(int x,int root);//前驱 
int Find_succ(int x,int root);//后继 
int Find_rank(int x,int root);//x的排名? 
int Find_rank_rev(int key,int root);//排名为key的是? 
int Split(int x,int root);//分离 
int Merge(int tree_x,int tree_y,int root);//合并
int Query_sum(int l,int r);//查询区间和 
int Query_GSS(int l,int r);//查询区间最大连续字段和 
//待补充 

 

posted @ 2016-12-17 08:42  神犇(shenben)  阅读(252)  评论(0编辑  收藏  举报