- 博客(6)
- 收藏
- 关注
原创 8 puzzle with A* algorithm
The main idea is from: http://www.cs.princeton.edu/courses/archive/spr10/cos226/assignments/8puzzle.html A* is used to find the best solution. The detail of A* could be found: http://web.mit.edu/
2016-12-10 21:23:48 2595 1
原创 weighted Independent set on trees
This is solved by dynamic programming, the algorithm is from lecture slide: http://www.cs.princeton.edu/~wayne/kleinberg-tardos/pdf/IntractabilityIII-2x2.pdf #include #include #include #inc
2016-12-05 23:13:04 654
原创 Independent set of tree with greedy algorithm
/* Independent set on trees, which could be solved by greedy algorithm. Key observation: if node v is a leaf, there exists a max cardinality independent set containing v. http://www.cs.princeton.edu/
2016-12-05 18:50:55 449
原创 3-coloring problem
#include #include #include using namespace std; bool isSafe(const vector> &graph, const vector &color, int v, int c) { for (int i = 0; i != graph.size(); ++i) if (graph[v][i] == 1 && color[i]
2016-12-03 18:16:16 698
原创 vertex cover problem with dynamic programming
#include #include #include #include #include using namespace std; struct node { int data; node *left, *right; int vc; // vc is the vertex cover count for the subtree. node(int d) : data(d
2016-12-02 18:24:06 420
原创 vertex cover approximate algorithm
Reference: http://www.geeksforgeeks.org/vertex-cover-problem-set-1-introduction-approximate-algorithm-2/ #include #include #include #include using namespace std; class Graph { private: in
2016-12-01 17:23:53 657
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人