摘要: 克鲁斯卡尔算法 (加边法) G(V, E) 带权连通无向图(1), 将 G 中的边按权值从小到大依次选取,若选取的边使生成树不构成回路,并入 TE 中。(2), 从剩下的边中选取边,执行操作 (1), 如此进行下去,直到 TE 中包含 n-1 条边为止,此时的T,此时的 T ,即为最小生成树。Kr... 阅读全文
posted @ 2013-01-17 18:08 小尼人00 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 首先简要介绍一下AC自动机:Aho-Corasick automation,该算法在1975年产生于贝尔实验室,是著名的多模匹配算法之一。一个常见的例子就是给出n个单词,再给出一段包含m个字符的文章,让你找出有多少个单词在文章里出现过。要搞懂AC自动机,先得有模式树(字典树)Trie和KMP模式匹配... 阅读全文
posted @ 2013-01-17 18:07 小尼人00 阅读(165) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #inclu... 阅读全文
posted @ 2013-01-17 18:06 小尼人00 阅读(118) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #inclu... 阅读全文
posted @ 2013-01-17 18:04 小尼人00 阅读(123) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #inclu... 阅读全文
posted @ 2013-01-17 18:03 小尼人00 阅读(104) 评论(0) 推荐(0) 编辑
摘要: kmp 很好,要熟练#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #incl... 阅读全文
posted @ 2013-01-17 18:02 小尼人00 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 二叉堆是完全二叉树或者是近似完全二叉树。二叉堆满足二个特性:1.父结点的键值总是大于或等于(小于或等于)任何一个子节点的键值。2.每个结点的左子树和右子树都是一个二叉堆(都是最大堆或最小堆)。当父结点的键值总是大于或等于任何一个子节点的键值时为最大堆。当父结点的键值总是小于或等于任何一个子节点的键值... 阅读全文
posted @ 2013-01-17 17:49 小尼人00 阅读(149) 评论(0) 推荐(0) 编辑
摘要: (print, import, 赋值语句) pass, del, exec语句的用法。有些自以为已经掌握的知识点,还隐藏着一些让人惊讶的特性。* 使用逗号输出 *>>> 1, 2, 3(1, 2, 3)>>> print 1, 2, 3 # print 参数并不能像我们预期那样构成一个元组1... 阅读全文
posted @ 2013-01-17 17:44 小尼人00 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 字典* 创建和使用字典 * dict()>>> phonebook = {'Alice': '2341', 'Beth': '9102', 'Ceil': '3258'}>>> phonebook{'Beth': '9102', 'Alice': '2341', 'Ceil': '3258'}>>>... 阅读全文
posted @ 2013-01-17 17:42 小尼人00 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 第3章 使用字符串 字符串的分割,联接,搜索。3.1 基本字符串操作标准的序列操作 (索引,分片,判断成员资格,求长度,最值) 对字符串同样使用。3.2 字符串格式化>>> format = "Hello, %s. %s enough for ya?" # %s>>> values = ('wor... 阅读全文
posted @ 2013-01-17 17:37 小尼人00 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Python最基本的数据结构 : 序列 『6种内建序列 - *元组和列表*』 元组vs列表 元组不能更改! 元组 做 字典的key,不能用列表!>>> edward = ['Uncle wang', 42]>>> john = ['John Smith', 50]>>> database = [ed... 阅读全文
posted @ 2013-01-17 17:35 小尼人00 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 第一章 基础知识1.1 简单使用和认识 python >>> 2**3 >>> pow(2, 3) >>> 2+8 >>> x = input("x: ") >>> print 'hello world' >>> print "hello world" ... 阅读全文
posted @ 2013-01-17 17:20 小尼人00 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 一:沉稳(1)不要随便显露你的情绪。***(2)不要逢人就诉说你的困难和遭遇。(3)在征询别人的意见之前,自己先思考,但不要先讲。(4)不要一有机会就唠叨你的不满。(5)重要的决定尽量有别人商量,最好隔一天再发布。(6)讲话不要有任何的慌张,走路也是。二:细心(1)对身边发生的事情,常思考它们的因果... 阅读全文
posted @ 2013-01-17 17:18 小尼人00 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 1、记住,平均每天看电视超过三个小时以上的,一定都是那些月收入不超过两千元的,如果你想要月收入超过两千,请不要把时间浪费在电视上。同样的道理,那些平均每天玩网络游戏或聊天超过三个小时以上的,也都是那些月收入不超过两千的。2、因为穷人很多,并且穷人没有钱,所以,他们才会在网络上聊天抱怨,消磨时间。你有... 阅读全文
posted @ 2013-01-17 17:07 小尼人00 阅读(113) 评论(0) 推荐(0) 编辑