algorithm
algorithm
heihuide
考研 ing~
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
选择排序(C语言)
#include<iostream>#include<algorithm>using namespace std;const int maxn=1005;int a[maxn];int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<n;i++){ for(int j=i原创 2022-01-28 11:36:35 · 644 阅读 · 0 评论 -
冒泡排序(C语言)
#include<iostream>#include<algorithm>using namespace std;const int maxn=1005;int a[maxn];int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<n;i++){ for(int j=i原创 2022-01-28 11:23:27 · 546 阅读 · 0 评论 -
堆排序(通俗易懂版)
#include<iostream>#include<algorithm>using namespace std;const int maxn=1005;int a[maxn];int len;void HeadAdjust(int a[],int k,int len){ a[0]=a[k]; for(int i=2*k;i<=len;i*=2){ if(i<len&&a[i]<a[i+1])原创 2022-01-28 11:17:44 · 216 阅读 · 0 评论 -
归并排序(通俗易懂版)
#include<iostream>#include<algorithm>using namespace std;const int maxn=1e5+10;int a[maxn],b[maxn];int n;void Merge(int a[],int low,int mid,int high){ int i,j,k; for(i=low;i<=high;i++) b[i]=a[i]; for(i=low,j=mid+1,k原创 2022-01-28 10:38:31 · 691 阅读 · 0 评论 -
pat甲级题型记录
1001 栈思想的应用1003 dijkstra算法最短路变式1005 数字转字符串以及字符串转数字1007 最大连续子序列原创 2021-12-13 19:39:44 · 210 阅读 · 0 评论 -
活用递推算法(待更新)
hhhh原创 2021-11-10 10:15:07 · 262 阅读 · 0 评论 -
算法学习杂记
最短路问题贪心问题活用递推pat A1093原创 2021-11-10 10:13:51 · 104 阅读 · 0 评论 -
algorithm——并查集
目录一:并查集解释二:例题一:并查集解释转的一个超级有意思,好懂的并查集解释。原链接在此 点此处故事读完,并查集就会了~~~~~江湖上散落着各式各样的大侠,有上千个之多。他们没有什么正当职业,整天背着剑在外面走来走去,碰到和自己不是一路人的,就免不了要打一架。但大侠们有一个优点就是讲义气,绝对不打自己的朋友。而且他们信奉“朋友的朋友就是我的朋友”,只要是能通过朋友关系串联起来的,不管拐了多少个弯,都认为是自己人。这样一来,江湖上就形成了一个一个的帮派,通过两两之间的朋友关系串联起来。原创 2020-08-26 10:24:38 · 259 阅读 · 0 评论 -
algorithm——一些有趣的思维题
HDU 1108#include"iostream"using namespace std;int main(){ int a,b,c[4],t,cnt; while(cin>>a>>b) { t=a%10; c[1]=t; c[2]=t*c[1]%10; c[3]=t*c[2]%10; c[0]=t*c[3]%10; cnt=c[b%4];原创 2020-08-26 09:55:29 · 203 阅读 · 0 评论 -
algorithm——动态规划
HDU2044#include"iostream"using namespace std;const int maxn=110;long long dp[maxn];int main(){ int t,a,b; cin>>t; while(t--) { cin>>a>>b; dp[0]=1; dp[1]=1; for(int i=2;i<=b;i++)原创 2020-08-26 09:52:59 · 283 阅读 · 0 评论
分享