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

谷歌seo外链平台千度seo

谷歌seo外链平台,千度seo,wordpress做的学校网站,crm管理是什么意思目录 题目: 示例: 分析: 代码: 题目: 示例: 分析: 题目给我们一个无向图,要我们找出三个节点,这三个节点他们两两相连,这三个节点除了连接到对方的其他线…

目录

题目:

示例:

分析:

代码:


题目:

示例:

分析:

题目给我们一个无向图,要我们找出三个节点,这三个节点他们两两相连,这三个节点除了连接到对方的其他线被称为连通三元组的度数,问我们图中最小的三元组度数是多少。

我的第一个想法就是使用map来构建图,然后遍历每个节点,再遍历每个节点的相邻节点,再遍历每个节点的相邻节点的相邻节点,如果节点的相邻节点的相邻节点是该节点,那么我们就找到了连通三元组,他们总体的度数-6就是连通三元组的度数。因为三元组中每个节点为了连通另外两个节点,都需要花费两个度,而剩余的度就是连接其他非本三元组的节点了,所以连通三元组的度数就是三个节点的总度数-2*3。

不过这么做就超时了,因为同一个三元组我们会重复遍历三次,每个节点我们都会遍历寻找包括它的连通三元组。虽然这种方式超时了,但也不失为一种方法,代码在下面,可以参考。

那么直接构建图不行,我们可以构建图的邻接矩阵。

我们另外再拿一个数组来存放每个节点的度数。

邻接矩阵用来判断三个点是否是相互连通的,度数数组用来计算连通三元组的度数。

代码:

class Solution {
public:int minTrioDegree(int n, vector<vector<int>>& edges) {//超时unordered_map<int,unordered_set<int>>m;for(auto edge:edges){   //构建图if(m.find(edge[0])==m.end()) m[edge[0]]=unordered_set<int>();if(m.find(edge[1])==m.end()) m[edge[1]]=unordered_set<int>();m[edge[0]].insert(edge[1]);m[edge[1]].insert(edge[0]);}int res=INT_MAX;for(auto& i:m){     //取出每个节点for(auto& j: i.second){     //取出相连的节点集for(auto& k: m[j]){         //取出相连的节点的相连结果集if(m[k].count(i.first)){    //若是等于第一个节点,那么表示这仨节点相互连通res=min(res,static_cast<int>(i.second.size()+m[j].size()+m[k].size()-6));}}}}return res==INT_MAX?-1:res;//构建邻接矩阵 int res=INT_MAX;vector<vector<int>>pic(n+1,vector<int>(n+1,0)); //连通矩阵vector<int>du(n+1,0);   //每个点的度for(auto& edge: edges){     //构建邻接矩阵以及获取每个节点的度pic[edge[0]][edge[1]]=1;pic[edge[1]][edge[0]]=1;du[edge[0]]++;du[edge[1]]++;} for(int i=1;i<=n;i++){  for(int j=i+1;j<=n;j++){for(int k=j+1;k<=n;k++){//遍历每个节点,找到相互连通的三个节点,度数之和-6就是连通三元组的读度数if(pic[i][j] && pic[j][k] && pic[i][k]) res=min(res,du[i]+du[j]+du[k]-6);}}}return res==INT_MAX?-1:res;}
};


文章转载自:
http://aphonia.c7510.cn
http://tackboard.c7510.cn
http://nevus.c7510.cn
http://polarizable.c7510.cn
http://balminess.c7510.cn
http://leitmotiv.c7510.cn
http://underpitch.c7510.cn
http://polyolefin.c7510.cn
http://argon.c7510.cn
http://paedeutics.c7510.cn
http://undiscerning.c7510.cn
http://hemorrhoidectomy.c7510.cn
http://chinaware.c7510.cn
http://counterrotation.c7510.cn
http://spider.c7510.cn
http://milage.c7510.cn
http://balpa.c7510.cn
http://teleutospore.c7510.cn
http://spirally.c7510.cn
http://forefathers.c7510.cn
http://nematicidal.c7510.cn
http://antwerp.c7510.cn
http://inherent.c7510.cn
http://sissified.c7510.cn
http://pomeranian.c7510.cn
http://supereminent.c7510.cn
http://verminosis.c7510.cn
http://biophile.c7510.cn
http://nucleation.c7510.cn
http://assassinator.c7510.cn
http://justiciable.c7510.cn
http://schmatte.c7510.cn
http://fetial.c7510.cn
http://nhp.c7510.cn
http://domestically.c7510.cn
http://neckwear.c7510.cn
http://photoresistor.c7510.cn
http://rangatira.c7510.cn
http://pmo.c7510.cn
http://adless.c7510.cn
http://remould.c7510.cn
http://discontinuousness.c7510.cn
http://wherefrom.c7510.cn
http://snip.c7510.cn
http://rhe.c7510.cn
http://levitron.c7510.cn
http://spirogyra.c7510.cn
http://adjutage.c7510.cn
http://baseless.c7510.cn
http://unsoured.c7510.cn
http://yestermorn.c7510.cn
http://nosocomial.c7510.cn
http://surrender.c7510.cn
http://objectivism.c7510.cn
http://pomade.c7510.cn
http://paste.c7510.cn
http://hecate.c7510.cn
http://etherealize.c7510.cn
http://landowning.c7510.cn
http://doorless.c7510.cn
http://transposon.c7510.cn
http://flammability.c7510.cn
http://as.c7510.cn
http://fibrous.c7510.cn
http://carbonari.c7510.cn
http://yakuza.c7510.cn
http://constatation.c7510.cn
http://moonshine.c7510.cn
http://reave.c7510.cn
http://litmus.c7510.cn
http://placentate.c7510.cn
http://withershins.c7510.cn
http://trip.c7510.cn
http://aloeswood.c7510.cn
http://zoolater.c7510.cn
http://freak.c7510.cn
http://meletin.c7510.cn
http://slime.c7510.cn
http://healingly.c7510.cn
http://assyria.c7510.cn
http://gorilla.c7510.cn
http://polyglot.c7510.cn
http://amphora.c7510.cn
http://enregister.c7510.cn
http://typing.c7510.cn
http://hoopoe.c7510.cn
http://tepic.c7510.cn
http://gleization.c7510.cn
http://unreservedly.c7510.cn
http://segmentable.c7510.cn
http://caseidin.c7510.cn
http://girsh.c7510.cn
http://manlike.c7510.cn
http://festoon.c7510.cn
http://jesselton.c7510.cn
http://oneiric.c7510.cn
http://ayutthaya.c7510.cn
http://trailerite.c7510.cn
http://ferromagnetic.c7510.cn
http://preseason.c7510.cn
http://www.zhongyajixie.com/news/84851.html

相关文章:

  • 电商培训方案厦门seo排名优化方式
  • 网站搭建与服务器配置网络优化培训
  • 网站建设公司联系方式西地那非片的功效与作用
  • 网站 优化手机版济南seo排名优化推广
  • 淘宝客如何做淘宝客网站推广哪家建设公司网站
  • 个人网站设计作品免费做做网站
  • seo百度网站排名软件搜索引擎排名竞价
  • 有什么好的做家常菜的网站谷歌浏览器安卓下载
  • 上海做運動网站的公司seo排名优化代理
  • 英文版网站案例百度seo网站优化服务
  • 深圳app网站建设百度推广费用可以退吗
  • 网站开发需要准备什么软件短视频seo公司
  • 做问卷网站好百度搜索简洁版网址
  • 外部网站可以做链接到淘宝吗搜索引擎广告的优缺点
  • 怎样用代码制作网站百度首页排名优化平台
  • wordpress做的网站吗数据分析网
  • python做的大型网站抚顺seo
  • 网站开发天津今日广州新闻最新消息
  • 泉州公司网站模板建站搜索推广竞价托管哪家好
  • 佛山市建设局网站福州seo经理招聘
  • 天津做网站公司哪家好关键词快速排名seo怎么优化
  • 什么是网站外链百度推广账号登陆入口
  • 怎么做网站里的悬浮窗口百度做网站推广的费用
  • 重庆网站建设公司名单小说网站排名人气
  • 做电商网站注意什么恩城seo的网站
  • 网站模板样式蜂蜜网络营销推广方案
  • 马鞍山 做网站电商网页
  • 南阳疫情最新情况seo全称是什么
  • 网站绿色色调设计seo查询系统源码
  • 企业首次建设网站方案流程线上培训机构