随笔分类 - ACM ( 数据结构 )
HDU 3468 HDOJ 3468 A Simple Problem with Integers ACM 3468 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--<prelang="cpp"line="1">/*Mailto:miyubai@gamil.comMyBlog:w...
阅读全文
HDU 3584 HDOJ 3584 Cube ACM 3584 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目描述:CubeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 495Accepted Submission(s): 226Problem DescriptionGive...
阅读全文
Splay Tree 介绍
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋伸展树(Splay Tree)是一种二叉排序树,它能在O(log n)内完成插入、查找和删除操作。它由Daniel Sleator和Robert Tarjan创造。它的优势在于不需要记录用于平衡树的冗余信息。在伸展树上的一般操作都基于伸展操作。查找树的相关知识 各种查找树存在不足。比如:对于一个有n个节点的平衡树,虽然最坏...
阅读全文
(转)伸展树 ( Splay tree )
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋伸展树(Splay Tree)是AVL树不错的替代,它有以下几个特点:(1)它是二叉查找树的改进,所以具有二叉查找树的有序性。(2)对伸展树的操作的平摊复杂度是O(log2n)。(3)伸展树的空间要求、编程难度非常低。提到伸展树,就不得不提到AVL树和Read-Black树,虽然这两种树能够保证各种操作在最坏情况下都为log...
阅读全文
树状数组 (Binary Indexed Trees )论文解析
摘要:Byboba5551TopCoder MemberIntroductionWe often need some sort of data structure to make our algorithms faster. In this article we willdiscuss theBinary Indexed Treesstructure. According toPeter M. Fenw...
阅读全文
HDU 2689 HDOJ 2689 Sort it ACM 2689 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址 :http://acm.hdu.edu.cn/showproblem.php?pid=2689题目描述: 其实就是求 冒泡排序时 的交换次数, 当然也可以求逆序数来解决问题, 下面是2份 代码:代码Code highlighting produced by Actipro CodeHighlighter (free...
阅读全文
HDU 1512 HDOJ 1512 Monkey King ( 左偏树 ) ACM 1512 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1512题目描述 :代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--Monkey...
阅读全文
左偏树详解 ( 转载 )
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋[代码]下面我们来分析合并操作的时间复杂度。从上面的过程可以看出,每一次递归合并的开始,都需要分解其中一棵树,总是把分解出的右子树参加下一步的合并。根据性质3,一棵树的距离决定于其右子树的距离,而右子树的距离在每次分解中递减,因此每棵树A或B被分解的次数分别不会超过它们各自的距离。根据性质4,分解的次数不会超过ël...
阅读全文
PKU 2528 POJ 2528 Mayor's posters ( 线段树+离散化 ) ACM 2528 IN PKU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址 : http://poj.org/problem?id=2528题目描述:[代码]Time Limit:1000MSMemory Limit:65536KTotal Submissions:15722Accepted:4444DescriptionThe citizens of Bytetown, AB, coul...
阅读全文
PKU 2352 POJ 2352 Stars ( 线段树版 ) ACM 2352 IN PKU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址 : http://poj.org/problem?id=2352题目描述:[代码]Time Limit:1000MSMemory Limit:65536KTotal Submissions:14814Accepted:6404DescriptionAstronomers often examine star map...
阅读全文
HDU 3016 HDOJ 3016 Man Down ACM 3016 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址 : http://acm.hdu.edu.cn/showproblem.php?pid=3016题目描述:[代码]The Game “Man Down 100 floors” is an famous and interesting game.You can enjoy the game f...
阅读全文
HDU 2871 HDOJ 2871 Memory Control ACM 2871 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2871题目描述:[代码]Memory units are numbered from 1 up to N.A sequence of memory units is called a memory block.The memor...
阅读全文
PKU 3667 HDOJ 3667 Hotel ACM 3667 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址 : http://poj.org/problem?id=3667题目描述:[代码]Time Limit:3000MSMemory Limit:65536KTotal Submissions:2993Accepted:1143DescriptionThe cows are journeying north to Th...
阅读全文
HDU 1540 HDOJ 1540 Tunnel Warfare ACM 1540 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=1540题目描述:Tunnel WarfareTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submiss...
阅读全文
HDU 1698 HDOJ 1698 Just a Hook ACM 1698 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址 : http://acm.hdu.edu.cn/showproblem.php?pid=1698题目描述 :Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submiss...
阅读全文
HDU 2795 HDOJ 2795 Billboard ACM 2795 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2795题目描述:[代码]At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height ...
阅读全文
HDOJ 1754 HDU 1754 I Hate It ACM 1754 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=1754题目描述: [代码]很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时...
阅读全文
HDOJ 1166 HDU 1166 敌兵布阵 ACM 1166 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋先前做了这一题, 不过是用 树状数组做的, 对于这一类型的题目也来说非常方便快捷. 具体地址 :http://www.cnblogs.com/MiYu/archive/2010/08/25/1808441.html这几天学了 线段树 , 不是很明白它的用途 和 使用方法, 因为 听说 树状数组是 线段树的 一种特殊情况 ( ...
阅读全文
HDOJ 2688 HDU 2688 Rotate ACM 2688 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2688题目描述:RotateTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): ...
阅读全文
HDOJ 3450 HDU 3450 Counting Sequences ACM 3450 IN HDU
摘要:MiYu原创, 转帖请注明 : 转载自______________白白の屋题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3450题目描述:Counting SequencesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/65536 K (Java/Others)Total Sub...
阅读全文