算法
cqggcqggcqggcqgg
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【算法设计与程序分析】0-1背包问题 (DP + 跳跃点 + 空间优化)
#include<iostream> #include<queue> #include<algorithm> #define MAXNUM 30 using namespace std; class Bag{ //在跳跃点解法时使用 public: Bag(){ val = 0; weight = 0; } public: int val; int weight; friend bool operator < (Bag a,Bag转载 2020-12-07 19:42:55 · 787 阅读 · 0 评论 -
蚁群算法求解TSP旅行商问题
问题:蚁群算法求解TSP旅行商问题 问题描述(数据来源):http://www.docin.com/p-513276781.html 数据 china.txt: 116.46 39.92 117.2 39.13 121.48 31.22 106.54 29.59 91.11 29.97 87.68 43.77 106.27 38.47 111.65 40.82 108.33 22.84 126.63 45.75 125.35 43.88 123.38 41.8 114.48 38.03 112.53 37.原创 2020-11-19 22:19:58 · 516 阅读 · 0 评论 -
遗传算法求解区间[0, 31]上的二次函数f(x) = x ^ 2的最大值
问题:遗传算法求解区间[0, 31]上的二次函数f(x) = x ^ 2的最大值 #include <bits/stdc++.h> using namespace std; const int maxn = 10; //种群数量 const int bit = 5; const int iteration = 200; //迭代次数 const double pc = 0.4; //交叉概率 const double pm = 0.02; //变异概率原创 2020-11-19 21:52:50 · 5572 阅读 · 0 评论 -
【数据结构】迪杰斯特拉(dijkstra)算法 单源最短路径(源点到其它点的最短距离)
#include <iostream> #include <cstring> #define maxn 500 #define INF 0x3f3f3f3f using namespace std; int graph[maxn][maxn]; //尽量定义全局变量 int vis[maxn]; //存已查找的顶点 int dis[maxn]; //各顶点到源点距离 int n, m; //顶点数、边数 void dijkstra(int原创 2020-10-06 17:19:46 · 913 阅读 · 0 评论
分享