2012年3月5日

I HATE IT 伸展树

摘要: View Code #include <stdio.h>#include <string.h>#include <algorithm>#include <stdlib.h>#include <math.h>#include <algorithm>#include <time.h>using namespace std;int left[200100], right[200100], maxn[200100], pf[200100], value[200100],root; //值为-1的点表示该结点为空 voi 阅读全文

posted @ 2012-03-05 00:54 more think, more gains 阅读(175) 评论(0) 推荐(0) 编辑

SPLAY树各种操作--链表

摘要: SPLAY树各种操作1.旋转2.插入3.删除4.查找5前驱6.后继7第k小/大8根据秩求元素View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>using namespace std;//节点定义typedef struct node{ node *child[2], *pf; int v, size;}*Node;Node root = NULL;void preordertravel( Node p ){ if( p ) { 阅读全文

posted @ 2012-03-05 00:40 more think, more gains 阅读(344) 评论(0) 推荐(0) 编辑

导航