上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 99 下一页

2012年3月5日

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) 编辑

2012年3月4日

1208: [HNOI2004]宠物收养所

摘要: 1208: [HNOI2004]宠物收养所1.用Treap树写:只需要三个操作,插入,删除,查找(同时找出其前继后继);View Code /************************************************************** Problem: 1208 User: 314911229 Language: C++ Result: Accepted Time:268 ms Memory:1732 kb*************************************************************... 阅读全文

posted @ 2012-03-04 20:31 more think, more gains 阅读(558) 评论(1) 推荐(0) 编辑

STL 平衡树数据结构容器

摘要: 1.mapkey只能对应一个映射值,支持插入,删除,查找(count, find), 修改(先删除此值,再插入修改后的值),排序,映射(离散话) multimap同样的键值可有多个映射View Code #include <stdio.h>#include <stdlib.h>#include <algorithm>#include <map>using namespace std;map<int, int>mp; int main( ){ int N,M, t; char str[1000]; while( scanf(" 阅读全文

posted @ 2012-03-04 14:40 more think, more gains 阅读(335) 评论(0) 推荐(0) 编辑

1503: [NOI2004]郁闷的出纳员

摘要: 1503: [NOI2004]郁闷的出纳员Time Limit:5 SecMemory Limit:64 MBSubmit:2056Solved:711[Submit][Status][Discuss]DescriptionOIER公司是一家大型专业化软件公司,有着数以万计的员工。作为一名出纳员,我的任务之一便是统计每位员工的工资。这本来是一份不错的工作,但是令人郁闷的是,我们的老板反复无常,经常调整员工的工资。如果他心情好,就可能把每位员工的工资加上一个相同的量。反之,如果心情不好,就可能把他们的工资扣除一个相同的量。我真不知道除了调工资他还做什么其它事情。 工资的频繁调整很让员工反感,尤其 阅读全文

posted @ 2012-03-04 00:28 more think, more gains 阅读(240) 评论(0) 推荐(0) 编辑

2012年3月3日

Splay树各操作--数组

摘要: 伸展树删除元素非常方便。。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[100010], right[100010], pf[100010];int value[100010];int num[100010]; //记录 阅读全文

posted @ 2012-03-03 22:44 more think, more gains 阅读(211) 评论(0) 推荐(0) 编辑

上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 99 下一页

导航