ACM
1
1
图论
.................................................................................................................................................................... 3
1.1 术语
...................................................................................................................................................... 3
1.2
独立集、覆盖集、支配集之间关系
.................................................................................................. 3
1.3 DFS .......................................................................................................................................................4
1.3.1
割顶
........................................................................................................................................ 6
1.3.2
桥
............................................................................................................................................ 6
1.3.3
强连通分量
............................................................................................................................ 7
1.4
最小点基
.............................................................................................................................................. 7
1.5
拓扑排序
.............................................................................................................................................. 7
1.6
欧拉路
.................................................................................................................................................. 8
1.7
哈密顿路(正确?)
.......................................................................................................................... 8
1.8 Bellman-ford .........................................................................................................................................9
1.9
差分约束系统(用
bellman-ford
解)
............................................................................................... 9
1.10 dag
最短路径
..................................................................................................................................... 10
1.11
二分图匹配
........................................................................................................................................ 11
1.11.1
匈牙利算法
.......................................................................................................................... 11
1.11.2 KM
算法
...............................................................................................................................12
1.12
网络流
................................................................................................................................................ 15
1.12.1
最大流
.................................................................................................................................. 15
1.12.2
上下界的网络的最大流
...................................................................................................... 17
1.12.3
上下界的网络的最小流
...................................................................................................... 17
1.12.4
最小费用最大流
.................................................................................................................. 17
1.12.5
上下界的网络的最小费用最小流
...................................................................................... 21
2
数论
.................................................................................................................................................................. 21
2.1
最大公约数
gcd ................................................................................................................................. 21
2.2
最小公倍数
lcm ................................................................................................................................. 21
2.3
快速幂取模
B^LmodP(O(logb)) ....................................................................................................... 21
2.4 Fermat
小定理
....................................................................................................................................22
2.5 Rabin-Miller
伪素数测试
.................................................................................................................. 22
2.6 Pollard-rho ..........................................................................................................................................22
2.7
扩展欧几里德算法
extended-gcd ......................................................................................................24
2.8
欧拉定理
............................................................................................................................................ 24
2.9
线性同余方程
ax
≡
b(mod n) .............................................................................................................24
2.10
中国剩余定理
.................................................................................................................................... 25
2.11 Discrete Logging(B
L
== N (mod P))..................................................................................................26
2.12 N!
最后一个不为
0
的数字
................................................................................................................27
2.13 2^14
以内的素数
............................................................................................................................... 27
3
数据结构
.......................................................................................................................................................... 31
3.1
堆(最小堆)
.................................................................................................................................... 31
3.1.1
删除最小值元素:
.............................................................................................................. 31
3.1.2
插入元素和向上调整:
...................................................................................................... 32
3.1.3
堆的建立
.............................................................................................................................. 32
3.2
并查集
................................................................................................................................................ 32
3.3
树状数组
............................................................................................................................................ 34