sth about sm-treap
来源:互联网 发布:seo查询爱站网 编辑:程序博客网 时间:2024/04/26 03:25
先开坑占位……忽然发现直接用split 和merge开树实在是蛋疼……nlgn什么的……
先来个split 和merge吧……
int size(node* a){return a?a->size:0;} int split(node* root,int k,node* &a, node* &b) { if(!root){a=b=0;return 0;} if(size(root->s[0])>=k) { split(root->s[0],k,a,b); root->s[0]=b; root->updata(); b=root; return 0; } else { split(root->s[1],k-size(a->[0])+1,a,b); root->s[1]=a; root->updata(); a=root; retrun 0; } }
再来一段merge
node* merge(node* a,node* b){ if (!a) return b; if (!b) return a; if(a->wei>=b->wei) { a->s[1]=merge(a->s[1],b); a->updata(); return a; }else { b->s[0]=merge(a,b->s[0]); b->updata(); return b; }}
然后最近研究vam emde boas……
0 0
- sth about sm-treap
- sth about Inheritance
- sth about "this"
- Sth. about WinCE
- sth about memcpy
- sth about "批处理文件"
- sth. about "批处理" "应用"
- sth about "批处理文件"(2)
- Sth. about Static Library
- sth about starcraft2
- sth about struts2
- Sth about java security
- STH about TOEFL
- sth about interview
- Sth about GitHub
- sth about 离散数学
- sth about Hadoop
- Sth about Java
- opencv中图像异或函数bitwise_xor
- 技术人员价值评测系统Merit
- XIB中设置UITextField的高度
- 关于C++指针类型所占大小的测试
- linux随心笔记之文件权限种类
- sth about sm-treap
- iOS开发-Git命令及操作
- 【iOS学习】十、利用背景色解决页面跳转卡顿
- 【经典算法】:用C语言画日历表
- 点阵字库简介及使用方法
- 二叉树的遍历
- 行列有序的二维数组查找
- android纠正知识点
- pb TreeView控件