摘要: 完整题目描述: William received N colored pencils as a present. Each pencil’s color is a combination of red, green and blue. The color of the ith colored pen 阅读全文
posted @ 2017-12-28 16:56 proscientist 阅读(180) 评论(0) 推荐(1) 编辑
摘要: 题目完整描述: You want to create a system to predict collapse of old buildings. Initial durability of all buildings is given and decreased every year by 1. 阅读全文
posted @ 2017-12-28 16:55 proscientist 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 参考《算法导论》的NIL哨兵介绍,可以使链表操作的头节点和尾结点判断更方便 阅读全文
posted @ 2017-12-28 16:53 proscientist 阅读(375) 评论(0) 推荐(0) 编辑
摘要: Trie树,即字典树,又称单词查找树或键树,是一种树形结构,是一种哈希树的变种。典型应用是用于统计和排序大量的字符串(但不仅限于字符串),所以经常被搜索引擎系统用于文本词频统计。它的优点是:最大限度地减少无谓的字符串比较,查询效率比哈希表高。核心思想是空间换时间。利用字符串的公共前缀来降低查询时间的 阅读全文
posted @ 2017-12-28 16:52 proscientist 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 二叉搜索树 特征:左子树的key值小于根节点,右子树的key值大于根节点。 模板程序 阅读全文
posted @ 2017-12-28 16:49 proscientist 阅读(257) 评论(0) 推荐(0) 编辑
摘要: STL库中可以用优先队列实现堆,以下是自己写的堆及其接口 练习题: /*Poj 2431 Heap 题意:一辆卡车要行驶L单位距离。最开始时,卡车上有P单位汽油,每向前行驶1单位距离消耗1单位汽油。如果在途中车上的汽油耗尽,则无法到达终点。途中共有N个加油站,加油站提供的油量有限,卡车的油箱无限大。 阅读全文
posted @ 2017-12-28 16:48 proscientist 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Poj 2299 统计如果要对一串数据排序,冒泡排序需要交换多少次 即求逆序数,可以用树状数组或者归并排序求取。 /*POJ 2299 归并排序解法 求逆序对的数目可以使用归并排序,其实逆序对的数目是归并排序的一个附属产品,只是在归并排序的过程中顺便算出来的。 (2路)归并排序的思想:先把每个数看成 阅读全文
posted @ 2017-12-28 16:47 proscientist 阅读(206) 评论(0) 推荐(0) 编辑
摘要: /*POJ 1324 题意: 给出一个n*m的贪吃蛇地图,以及贪吃蛇现在身体各个块所在的位置,求它的头走到(1,1)位置最少需要多少步。 其中蛇在移动的过程中不能走到障碍物上,也不能撞到自己的身体上。 题解:写迷宫问题首先应该避免死循环,即相同状态不能多次入队。本次搜索状态不仅有蛇头的位置还有蛇身的 阅读全文
posted @ 2017-12-28 16:46 proscientist 阅读(490) 评论(0) 推荐(0) 编辑
摘要: 题目:DFS练习题目 附上一道相似的题目,给定一些木棒,求可拼接出的最大矩形面积。 Execution time : 10 sec(C/C++) / 20 sec(JAVA) for 95 cases combinedMemory : Maximum 256MB available for heap 阅读全文
posted @ 2017-12-28 16:44 proscientist 阅读(193) 评论(0) 推荐(0) 编辑
摘要: KM算法 KM算法用来求二分图最大权完美匹配 一般对KM算法的描述,基本上可以概括成以下几个步骤: (1) 初始化可行标杆 (2) 用匈牙利算法寻找完备匹配 (3) 若未找到完备匹配则修改可行标杆 (4) 重复(2)(3)直到找到相等子图的完备匹配 入门题:HDU2255,复杂度应该是O(N^3) 阅读全文
posted @ 2017-12-28 16:41 proscientist 阅读(401) 评论(0) 推荐(0) 编辑
摘要: 完整英文题意: Froggy lives in a beautiful pond where there are N lotuses numbered from 1 to N in order. When looking down at the pond, it seems like the lot 阅读全文
posted @ 2017-12-28 16:40 proscientist 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 完整题目描述: Electronics Company owned by Dan has N employees.This year, the company has N new projects to work on.Each employee should be assigned to only 阅读全文
posted @ 2017-12-28 14:05 proscientist 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 完整题目描述: Monroe, Brad and William have been participating in Samsung TeamProgramming as a team. As always, they are getting ready for this year’s progr 阅读全文
posted @ 2017-12-28 14:04 proscientist 阅读(196) 评论(0) 推荐(0) 编辑
摘要: RMQ 之 ST算法 阅读全文
posted @ 2017-12-28 13:22 proscientist 阅读(145) 评论(0) 推荐(0) 编辑