原文链接 http://blog.csdn.net/xin_jmail/article/details/29597471 http://blog.csdn.net/xin_jmail/article/details/32101483…
笔者:白松 NPU学生. 转载请注明出处:http://blog.csdn.net/xin_jmail/article/details/32101483. 本文參加了2014年CSDN博文大赛,假设您认为此文对您有所帮助.就请为我投上您宝贵的一票,不胜感激. 投票地址:http://vote.blog.csdn.net/Article/Details?articleid=32101483 . 本文目的:解说并行Finding a Maximal Independent Set(寻找最大独立集问题…
http://www.geeksforgeeks.org/largest-independent-set-problem/ #include <iostream> #include <vector> #include <algorithm> #include <queue> #include <stack> #include <string> #include <fstream> #include <map>…
概述: 最大团问题(Maximum Clique Problem, MCP)是图论中一个经典的组合优化问题,也是一类NP完全问题.最大团问题又称为最大独立集问题(Maximum Independent Set Problem).目前,求解MCP问题的算法主要分为两类:确定性算法和启发式算法.确定性算法有回溯法.分支限界法等,启发式算法.蚁群算法.顺序贪婪算法.DLS-MC算法和智能搜索算法等. 问题描述: 给定无向图G=(V,E),其中V是顶点集:E是V边集.如果U属于V,且对任意两个顶点u,v…
0x01 从判定问题到形式语言 这篇讲知识证明的wiki([1]): https://en.wikipedia.org/wiki/Proof_of_knowledge 里面有一句话: Let x be a language element of language L in NP 这篇讲NPC的文章([2]) http://www.cs.princeton.edu/courses/archive/spr11/cos423/Lectures/NP-completeness.pdf 里面提到Decis…
    HamaWhite 原创,转载请注明出处!欢迎大家增加Giraph 技术交流群: 228591158     Graph coloring is the problem of assigning a color to each vertex of an undirected graph such that no two adjacent vertices have the same color. We implement the greedy algorithm from Scalabl…
D. Bubble Sort Graph time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with n elements a1, a2, ..., an …
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud  Bubble Sort Graph Iahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with n elements a1, a2, ..., an in ascending order. He is bored of this so simple al…
先上最大团定义: 最大团问题(Maximum Clique Problem, MCP)是图论中一个经典的组合优化问题,也是一类NP完全问题,在国际上已有广泛的研究,而国内对MCP问题的研究则还处于起步阶段,因此,研究最大团问题具有较高的理论价值和现实意义. 最大团问题又称为最大独立集问题(Maximum Independent Set Problem).启发式算法.确定性算法有回溯法.分支限界法等,启发式算法.蚁群算法.顺序贪婪算法.DLS-MC算法和智能搜索算法等. 给定无向图G=(V,E).…
This is a list of some of the more commonly known problems that are NP-complete when expressed as decision problems. As there are hundreds of such problems known, this list is in no way comprehensive. Many problems of this type can be found in Garey…
动态规划 1.背包问题 (1)01背包 ,n) DFR(v,V,C[i]) F[v]=max(F[v],F[v-C[i]]+W[i]); } //初始化时 //若背包不一定装满F全初始化为0 //若装满 F[0]=0 其他为-inf   (2)全然背包 ,n) FOR(v,C[i],V) {F[v]=max(F[v],F[v-C[i]]+W[i]);} } (3)多重背包 ; ZeroOnePack(C[i]*M[i],W{i]*M[i]) } }   //O(VN) 单调队列? ? (4)多重…
接着是C,D的题解 C. Tourist Problem Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilometer 0. The n destina…
Just A Mistake Time Limit: 5000/5000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 168    Accepted Submission(s): 41 Problem Description As we all know, Matt is an outstanding contestant in ACM-ICPC. Graph proble…
As we all know, Matt is an outstanding contestant in ACM-ICPC. Graph problems are his favorite.Once, he came up with a simple algorithm for finding the maximal independent set in trees by mistake.A tree is a connected undirected graph without cycles,…
CSDN博文大赛已经開始两周啦.如今赛况怎样呢,接下来,小编为大家揭晓. 大赛自2014年6月10日正式开赛以来.博友们踊跃发表文章,提交文章.到眼下为止,博主们提交博文1045余篇.且以上这些数据还在迅速地添加中. 通过博客大赛,大江南北的业内朋友们能够共享经验.交流感受:行业内的伯乐也可有机会相马.识别精英. 博客大赛第一阶段将于7月10日截止提交博文.评出晋级博文.7月15日发布晋级名单.获得三个绿灯的,每篇博文奖励价值100元的奖品. 特别提醒:參赛文章必须是在大赛各阶段内新发表的原创文…
问题描述:就是在图中找最小的点集,使得覆盖所有边. 和独立集等价:独立集问题:在图中找最大的点集,使得点集内的所有点互不相连. 引理:顶点覆盖集和独立集互补. 上面这个引理使得这两个问题可以相互规约,从而这两个问题等价. 等价问题:给定图G和数k, 问G包含大小至少为k的独立集吗? 为什么等价:如果我们能在多项式时间内给出这个问题的答案,那么我们可以通过二分查找得到最大独立集的size为K.一个点如果是最大独立集中的点,等价于除去这个点后得到的图G'含有一个K-1大小的独立集.那么我们每次选取一…
independent set 1 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 102400K,其他语言204800K64bit IO Format: %lld 题目描述 Note: For C++ languages, the memory limit is 100 MB. For other languages, the memory limit is 200 MB. In graph theory, an independent set is a set of nonad…
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 0 0 1 0 Return 4. Credits:Special thanks to @Freezen for adding this pr…
选自<Reinforcement Learning: An Introduction>, version 2, 2016, Chapter2 https://webdocs.cs.ualberta.ca/~sutton/book/bookdraft2016sep.pdf 引言中是这样引出Chapter2的: One of the challenges that arise in reinforcement learning, and not in other kinds of learning…
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=26913 思路:水题一枚,就是求最大独立集.最大独立集=顶点数-最大匹配. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> using namespace std; #define M…
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1416 题目大意:一个老师带他的一群学生去旅游.带走的这群学生整体必须满足给出四个条件之一.问最多能带走多少学生. 解题思路: 二分图匹配题.最初我是这样考虑的:符合条件的学生连一条边,求最大匹配*2就行了. 但是问题却没那么简单.最大匹配保证的是多少人被匹配,至于匹…
题目链接:http://poj.org/problem?id=2771 Guardian of Decency Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 5517   Accepted: 2322 Description Frank N. Stein is a very conservative high-school teacher. He wants to take some of his students on…
题目链接:http://poj.org/problem?id=1466 Girls and Boys Time Limit: 5000MS   Memory Limit: 10000K Total Submissions: 12026   Accepted: 5355 Description In the second year of the university somebody started a study on the romantic relations between the stu…
Questions that are independent of programming language.  These questions are typically more abstract than other categories. Free Language Agnostic Programming Books 97 Things Every Programmer Should Know Algorithms and Data-Structures (PDF) Algorithm…
题目链接: http://www.lydsy.com/JudgeOnline/problem.php?id=1143 题解: 给你一个DAG,求最大的顶点集,使得任意两个顶点之间不可达. 把每个顶点v拆成v和v',对于边u,v,建成(u,v'),得到一个二分图. 先对二分图floyd求闭包,然后求二分图的最大独立集就可以了. 代码: #include<iostream> #include<cstdio> #include<cstring> using namespace…
http://poj.org/problem?id=1466 Girls and Boys Time Limit: 5000MS   Memory Limit: 10000K Total Submissions: 11085   Accepted: 4956 Description In the second year of the university somebody started a study on the romantic relations between the students…
Problem H. Horrible Truth Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100610 Description In a Famous TV Show “Find Out” there are n characters and only one Horrible Truth. To make the series breathtaking all way long, the sc…
Problem H. Hard TestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/attachments Description Andrew is having a hard time preparing his 239-th contest for Petrozavodsk. This time the solution to the problem is based on Di…
 UVa 1380 A Scheduling Problem 题目: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=41557 思路:   给出一个任务调度树,单向边u->v表示u必须在v之前完成,双向边u-v表示无所谓方向. 题目给出定理,首先dfs求得忽略无向边后的最长链点数k,那么问题就是判断是否可以通过无向边定向从而使得最长链点数不超过k.用dp的判断. 设f[i]表示以i为根的子树中所有的边定向后最长链点数不超过…
Girls and Boys Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8470    Accepted Submission(s): 3890 Problem Description the second year of the university somebody started a study on the romant…