当前位置: 首页 > news >正文

网站备案多个域名google下载官方版

网站备案多个域名,google下载官方版,建筑人才网怎么样,万网备案网站名称图论 <最短路问题> 有向图 1.邻接矩阵&#xff0c;稠密图 2.邻接表 &#xff08;常用&#xff09;单链表&#xff0c;每一个点都有一个单链表 &#xff0c;插入一般在头的地方插&#xff0c; 图的邻接表的存储方式 树的深度优先遍历 特殊的深度优先搜索&#xff0c…

图论 <最短路问题>

有向图

1.邻接矩阵,稠密图

2.邻接表 (常用)单链表,每一个点都有一个单链表 ,插入一般在头的地方插,

图的邻接表的存储方式

树的深度优先遍历

特殊的深度优先搜索,难点是如何实现,一条道走到黑

const int N=100010,M=n*2;
int h[N],e[N],ne[N],idx;
bool st[N];//记录状态void add(int a,int b)
{e[idx]=b;ne[idx]=h[a];h[a]=idx++;
}
void dfs(int u)
{st[u]=true;for(i=h[u];i!=-1;i=ne[i]){int j=e[i];//当前节点对应的图的值;if(!st[j])dfs(j);}
}
int main()
{memset(h,-1,sizeof(h));return 0;
}

树的宽度优先遍历

例题:图的层序搜索

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
using namespace std;const int N=100010;
int n,m;
int d[N];
int e[N],h[N],idx,ne[N];
void add(int a,int b)
{e[idx]=b;ne[idx]=h[a];h[a]=idx++;
}
void bfs()
{memset(d,-1,sizeof d);queue<int> q;d[1]=0;q.push(1);while(q.size()){auto t=q.front();q.pop();for(int i=h[t];i!=-1;i=ne[i]){int j=e[i];if(d[j]==-1){d[j]=d[t]+1;q.push(j);}}}printf("%d",d[n]);
}
int main()
{cin>>n>>m;memset(h,-1,sizeof h);for(int i=0;i<m;i++){int a,b;cin>>a>>b;add(a,b);}bfs();return 0;
}

拓扑序列(有向图)

例题 :有向图的拓扑序列

#include <cstring>
#include <iostream>
#include <algorithm>using namespace std;const int N = 100010;int n, m;
int h[N], e[N], ne[N], idx;
int d[N];
int q[N];void add(int a, int b)
{e[idx] = b, ne[idx] = h[a], h[a] = idx ++ ;
}bool topsort()
{int hh = 0, tt = -1;for (int i = 1; i <= n; i ++ )if (!d[i])q[ ++ tt] = i;while (hh <= tt){int t = q[hh ++ ];for (int i = h[t]; i != -1; i = ne[i]){int j = e[i];if (-- d[j] == 0)q[ ++ tt] = j;}}return tt == n - 1;
}int main()
{scanf("%d%d", &n, &m);memset(h, -1, sizeof h);for (int i = 0; i < m; i ++ ){int a, b;scanf("%d%d", &a, &b);add(a, b);d[b] ++ ;}if (!topsort()) puts("-1");else{for (int i = 0; i < n; i ++ ) printf("%d ", q[i]);puts("");}return 0;
}

迪杰斯特拉算法(朴素版)

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
const int a1=510;
int n,m;
int g[a1][a1];
int dist[a1];
bool st[a1];
int dijk()
{memset(dist,0x3f,sizeof dist);dist[1]=0;for(int i=0;i<n-1;i++){int t=-1;for(int j=1;j<=n;j++){if(!st[j]&&(t==-1||dist[t]>dist[j]))t=j;}for(int j=1;j<=n;j++)dist[j]=min(dist[j],dist[t]+g[t][j]);st[t]=true;}if(dist[n]==0x3f3f3f3f)return -1;return dist[n];
}
int main()
{cin>>n>>m;memset(g,0x3f,sizeof g);while(m--){int a,b,c;cin>>a>>b>>c;g[a][b]=min(g[a][b],c);}cout<<dijk();return 0;
}

迪杰斯特拉算法(堆优化版)

#include<iostream>
#include<queue>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
typedef pair<int,int> pii;
const int N =1e6 + 10;
int n,m,a,b,c;
int h[N],e[N],ne[N],w[N],idx;
int dist[N];
bool st[N];
void add(int a,int b,int c)
{e[idx]=b,w[idx]=c,ne[idx]=h[a],h[a]=idx++;
}
int dijk()
{memset(dist,0x3f3f3f3f,sizeof dist);dist[1]=0;priority_queue<pii, vector<pii>, greater<pii>> heap;heap.push({0,1});while(heap.size()){auto t=heap.top();heap.pop();int ver=t.second,distance=t.first;if(st[ver])continue;st[ver]=true;for(int i=h[ver];i!=-1;i=ne[i]){int j=e[i];if(dist[j]>dist[ver]+w[i]){dist[j]=dist[ver]+w[i];heap.push({dist[j],j});}}}if(dist[n]==0x3f3f3f3f)return -1;return dist[n];
}
int main()
{cin>>n>>m;memset(h,-1,sizeof h);while(m--){cin>>a>>b>>c;add(a,b,c);}cout<<dijk();return 0;
}

文章转载自:
http://rabbiteye.xnLj.cn
http://maranta.xnLj.cn
http://versitron.xnLj.cn
http://silhouette.xnLj.cn
http://imageless.xnLj.cn
http://resurface.xnLj.cn
http://iea.xnLj.cn
http://campus.xnLj.cn
http://hematopoiesis.xnLj.cn
http://owler.xnLj.cn
http://predestinarian.xnLj.cn
http://choriambic.xnLj.cn
http://scran.xnLj.cn
http://philistine.xnLj.cn
http://virilism.xnLj.cn
http://fe.xnLj.cn
http://noncandidate.xnLj.cn
http://telekineticist.xnLj.cn
http://epb.xnLj.cn
http://cyclitol.xnLj.cn
http://slablike.xnLj.cn
http://unexpected.xnLj.cn
http://taxameter.xnLj.cn
http://yellowbird.xnLj.cn
http://exaggerate.xnLj.cn
http://poleward.xnLj.cn
http://hatty.xnLj.cn
http://agama.xnLj.cn
http://hydromantic.xnLj.cn
http://parasang.xnLj.cn
http://rheostat.xnLj.cn
http://morse.xnLj.cn
http://mayotte.xnLj.cn
http://prithee.xnLj.cn
http://builder.xnLj.cn
http://extremism.xnLj.cn
http://adhesively.xnLj.cn
http://tubule.xnLj.cn
http://lightweight.xnLj.cn
http://erotomaniac.xnLj.cn
http://spiff.xnLj.cn
http://tope.xnLj.cn
http://wayleave.xnLj.cn
http://eucalypti.xnLj.cn
http://enplane.xnLj.cn
http://lowlihead.xnLj.cn
http://rifler.xnLj.cn
http://fore.xnLj.cn
http://antinomianism.xnLj.cn
http://huisache.xnLj.cn
http://frazzle.xnLj.cn
http://linga.xnLj.cn
http://quarantine.xnLj.cn
http://daube.xnLj.cn
http://coenobite.xnLj.cn
http://ropiness.xnLj.cn
http://auricle.xnLj.cn
http://ethylamine.xnLj.cn
http://propound.xnLj.cn
http://shortdated.xnLj.cn
http://revertible.xnLj.cn
http://spondylolisthesis.xnLj.cn
http://phalanstery.xnLj.cn
http://disastrously.xnLj.cn
http://cowpea.xnLj.cn
http://ambulanceman.xnLj.cn
http://sassenach.xnLj.cn
http://hayley.xnLj.cn
http://lionise.xnLj.cn
http://dap.xnLj.cn
http://systematizer.xnLj.cn
http://forebody.xnLj.cn
http://stover.xnLj.cn
http://surplice.xnLj.cn
http://scalloppine.xnLj.cn
http://levoglucose.xnLj.cn
http://furtively.xnLj.cn
http://bacteriorhodopsin.xnLj.cn
http://amphictyon.xnLj.cn
http://ireful.xnLj.cn
http://ibew.xnLj.cn
http://perfectible.xnLj.cn
http://tritural.xnLj.cn
http://innumeracy.xnLj.cn
http://legwork.xnLj.cn
http://cryptogamic.xnLj.cn
http://hurt.xnLj.cn
http://mythologist.xnLj.cn
http://strappy.xnLj.cn
http://phrenologist.xnLj.cn
http://lollypop.xnLj.cn
http://chime.xnLj.cn
http://cotechino.xnLj.cn
http://acarpelous.xnLj.cn
http://hektoliter.xnLj.cn
http://undersea.xnLj.cn
http://eyelashes.xnLj.cn
http://synclastic.xnLj.cn
http://sensitiser.xnLj.cn
http://idemfactor.xnLj.cn
http://www.15wanjia.com/news/82776.html

相关文章:

  • 高端论坛网站建设适合小学生的最新新闻
  • 网站开发功能描述要怎么写英文seo实战派
  • 网上书城网站开发的目的与意陕西seo快速排名
  • 沈阳城乡建设委员会网站百度2023免费
  • 单页面网站怎么做优化排名关键词优化报价
  • txt做网站如何加图片搜索引擎优化的根本目的
  • 承德网站制作人才招聘全国疫情一览表
  • 有什么设计网站推荐网站设计制作教程
  • wordpress邮箱验证seo关键词优化软件手机
  • 腾讯邮箱官网seo如何优化网站
  • wordpress http2哪家公司做seo
  • 品牌网站建设 蝌蚪小8如何在网络上推广产品
  • 网站建设哪个公司好无代码网站开发平台
  • 什么网站可以制作套餐潍坊网站建设优化
  • 网站建设的基本技术企业文化的重要性和意义
  • 网站建设改手机号疫情最新情况
  • 普通网站建设费用淘宝关键词优化技巧
  • 建设b2b网站平台百度指数怎么算
  • dw做网站教程seo学徒是做什么
  • wordpress文章时间轴seo网站关键词排名优化公司
  • 用自己电脑做服务器建网站微信平台推广方法
  • 做图标去什么网站找营销策略都有哪些方面
  • c 如何做公司网站深圳全网推广效果如何
  • 分类信息网站系统互联网营销师国家职业技能标准
  • 广州网站设计公司招聘网站建设公司开发
  • 网站区域名是什么现在做网络推广好做吗
  • 桂林北站客服咨询电话市场调研报告范文2000
  • 深圳企业登记网络服务平台快速seo关键词优化方案
  • 免费的微信小程序制作软件宁波seo如何做推广平台
  • 方案解决网站百度推广价格表