摘要: Count of Smaller Number before itselfGive you an integer array (index from 0 to n-1, where n is the size of this array, value from 0 to 10000) . For e... 阅读全文
posted @ 2015-06-14 20:24 Eason Liu 阅读(1198) 评论(0) 推荐(0) 编辑
摘要: bob, joe, bob, jane, bob, joe, jackbob = 3 joe = 2topN(2) = bob, joe .interface TopN { void insert(String query); List getTop(int n);}用map来存string在数... 阅读全文
posted @ 2015-06-14 19:33 Eason Liu 阅读(441) 评论(0) 推荐(0) 编辑
摘要: 线段树(单点修改) 1 #include 2 using namespace std; 3 4 struct node { 5 int start, end; 6 int val; 7 node *left, *right; 8 node(int _start, ... 阅读全文
posted @ 2015-06-14 18:48 Eason Liu 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Fluery算法: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 /* 9 弗罗莱算法10 */11 12 #define MAXN 100513 14 int stk[... 阅读全文
posted @ 2015-06-14 18:28 Eason Liu 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 二分图判定:二着色 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 int T; 8 int N, M; 9 int c[10001];10 bool visit[10001];11 vector... 阅读全文
posted @ 2015-06-14 18:26 Eason Liu 阅读(97) 评论(0) 推荐(0) 编辑
摘要: Prim算法: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int N; 7 vector> graph; 8 vector lowcost; 9 vector closest;10 11 void solve() ... 阅读全文
posted @ 2015-06-14 18:23 Eason Liu 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Dijkstra算法: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 int N, M, S, T; 9 vector > m(1001, vector(1001));1... 阅读全文
posted @ 2015-06-14 18:21 Eason Liu 阅读(137) 评论(0) 推荐(0) 编辑