- 博客(3)
- 收藏
- 关注
原创 Kruscal算法的C++实现
#include #include #include #include using namespace std;int mst = 0;struct edge { int u, v, w;};edge edges[10000];int index[10000];int find(int x){ if (index[x] == x) { return ind
2017-09-13 23:16:08
836
1
原创 最长公共子序列(LCS)的C++实现
首先有如下递归式绘制图表如下首先我们实现最长公共子序列长度的输出,代码如下:#include#include#include#includeusing namespace std;int table[100][100] = { 0 };int main(){ string a, b; cin >> a >> b; int m = a.length(); i
2017-07-26 22:09:41
5356
1
原创 算法导论例题——钢管切割
算法导论》(CLRS)中第一个dp例题(rodcutting)的C++代码#include#include#includeusing namespace std;int main(){ int price[11] = { 0,1,5,8,9,10,17,17,20,24,30 }; int n; cin >> n; vector table(n+1,0); for (int i =
2017-07-26 17:56:43
3628
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人