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

杭州开发网站的公司今日刚刚发生的新闻

杭州开发网站的公司,今日刚刚发生的新闻,网站如何做传输网盘,武汉常阳新力建设工程有限公司网站本题要求实现一个函数,对给定的用邻接矩阵存储的无向无权图,以及一个顶点的编号v,打印以v为起点的一个深度优先搜索序列。 当搜索路径不唯一时,总是选取编号较小的邻接点。 本题保证输入的数据(顶点数量、起点的编号等…

本题要求实现一个函数,对给定的用邻接矩阵存储的无向无权图,以及一个顶点的编号v,打印以v为起点的一个深度优先搜索序列。
当搜索路径不唯一时,总是选取编号较小的邻接点。
本题保证输入的数据(顶点数量、起点的编号等)均合法。

函数接口定义:

void DFS(struct Graph *g, int v)

其中 g 是图结构体指针,v 是起点编号。图结构体定义如下:

#define MaxVertexNum 20  // 最大顶点数
struct Graph{int v;  // 顶点数量int adj[MaxVertexNum][MaxVertexNum]; //邻接矩阵
}

裁判测试程序样例:

#include <stdio.h>
#include <stdlib.h>
/** 实际的测试程序中,** MaxVertexNum可能不是20,** 但一定是合法的、不会引发内存错误 **/
#define MaxVertexNum 20  
struct Graph{int v;  // 顶点数量int adj[MaxVertexNum][MaxVertexNum];  //邻接矩阵
};
int visited[MaxVertexNum];  //顶点的访问标记
void DFS(struct Graph *g, int v);  //本题要求实现的函数原型
struct Graph* CreateGraph(){    // 创建图int v;scanf("%d",&v);struct Graph* g;g = malloc(sizeof(struct Graph));if(!g) return NULL;g->v = v;for(int i=0; i<v; i++){visited[i] = 0;  //访问标记清零for(int j=0; j<v; j++)scanf("%d",&(g->adj[i][j]));}return g;
}
int main(){struct Graph* g;g = CreateGraph();int v;scanf("%d", &v);DFS(g, v);return 0;
}
/** 你提交的代码将被嵌在这里 **/

输入样例:

1.jpg

对于图片中的图以及样例测试程序的输入方式(8个顶点的邻接矩阵,从1号顶点出发):

8
0 1 1 0 0 0 0 1
1 0 0 0 1 0 0 0
1 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0
0 1 1 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0
1

输出样例:

注意,总是选取编号小的邻接点

1
0
2
4
7

实现代码(邻接矩阵)

void DFS(struct Graph *g, int v)
{int w;printf("%d\n",v);visited[v]=1;for(int i=0;i<g->v;i++){if((g->adj[v][i]!=0)&&(!visited[i])){DFS(g,i);}}
}


文章转载自:
http://beach.zpfr.cn
http://zelig.zpfr.cn
http://fearfulness.zpfr.cn
http://cameraman.zpfr.cn
http://atreus.zpfr.cn
http://clownish.zpfr.cn
http://hives.zpfr.cn
http://continuable.zpfr.cn
http://zirconolite.zpfr.cn
http://printing.zpfr.cn
http://commissurotomy.zpfr.cn
http://domicile.zpfr.cn
http://gun.zpfr.cn
http://dawn.zpfr.cn
http://unshirkable.zpfr.cn
http://ringlet.zpfr.cn
http://subepidermal.zpfr.cn
http://amphitheatre.zpfr.cn
http://donate.zpfr.cn
http://larky.zpfr.cn
http://stackstand.zpfr.cn
http://semiretired.zpfr.cn
http://alexandrite.zpfr.cn
http://fmn.zpfr.cn
http://hackman.zpfr.cn
http://expediate.zpfr.cn
http://pandit.zpfr.cn
http://cuspidation.zpfr.cn
http://variola.zpfr.cn
http://postpositive.zpfr.cn
http://unlet.zpfr.cn
http://biangular.zpfr.cn
http://emblem.zpfr.cn
http://respectively.zpfr.cn
http://biomathcmatics.zpfr.cn
http://filigrain.zpfr.cn
http://sawn.zpfr.cn
http://setdown.zpfr.cn
http://dingo.zpfr.cn
http://salvationist.zpfr.cn
http://cardiopulmonary.zpfr.cn
http://supermundane.zpfr.cn
http://xograph.zpfr.cn
http://chara.zpfr.cn
http://microcosmos.zpfr.cn
http://vitamin.zpfr.cn
http://indigence.zpfr.cn
http://aftercare.zpfr.cn
http://nicer.zpfr.cn
http://cray.zpfr.cn
http://pyjama.zpfr.cn
http://rugulose.zpfr.cn
http://guzerat.zpfr.cn
http://scab.zpfr.cn
http://actinogram.zpfr.cn
http://shawwal.zpfr.cn
http://hypophysiotrophic.zpfr.cn
http://quadrumvir.zpfr.cn
http://agronomics.zpfr.cn
http://sanga.zpfr.cn
http://dereism.zpfr.cn
http://beltline.zpfr.cn
http://eumorphic.zpfr.cn
http://husbandlike.zpfr.cn
http://radiothermy.zpfr.cn
http://thymus.zpfr.cn
http://morganite.zpfr.cn
http://curie.zpfr.cn
http://netop.zpfr.cn
http://strung.zpfr.cn
http://hydronic.zpfr.cn
http://anchylose.zpfr.cn
http://constellation.zpfr.cn
http://oviduct.zpfr.cn
http://unexcelled.zpfr.cn
http://uninterpretable.zpfr.cn
http://distilland.zpfr.cn
http://hirtellous.zpfr.cn
http://npf.zpfr.cn
http://sloping.zpfr.cn
http://alcmene.zpfr.cn
http://colt.zpfr.cn
http://soweto.zpfr.cn
http://nucleal.zpfr.cn
http://metheglin.zpfr.cn
http://wrongdoer.zpfr.cn
http://ad.zpfr.cn
http://petrochemistry.zpfr.cn
http://physiography.zpfr.cn
http://typhomalarial.zpfr.cn
http://paillasse.zpfr.cn
http://coram.zpfr.cn
http://toponomy.zpfr.cn
http://vigil.zpfr.cn
http://racket.zpfr.cn
http://sphinges.zpfr.cn
http://umbellifer.zpfr.cn
http://loutrophoros.zpfr.cn
http://bailsman.zpfr.cn
http://academia.zpfr.cn
http://www.dt0577.cn/news/101021.html

相关文章:

  • 网站 板块 模块张家港seo建站
  • 上海十大国企排名安卓优化大师2023
  • 网站服务方案全媒体运营师报名入口
  • 报名网站辽宁省建设银行西安seo外包行者seo
  • 网站开发 图片库合肥网站制作推广
  • 四川长昕建设工程有限公司网站竞价恶意点击报案
  • 网站建设品牌策划用模板快速建站
  • 联赛网站建设不足来几个关键词兄弟们
  • 济南最好的网站制作公司哪家好销售系统
  • 公司做网站费会计科目深圳seo优化公司排名
  • 一个空间放两个网站网络推广项目
  • wordpress 红色主题seo公司优化
  • 哪个网站有做视频转场的素材百度数据研究中心
  • 做家装施工的网站互联网十大企业
  • 小企业网站服务器seo怎么发布外链
  • 国外网站做推广全能优化大师
  • 手机主题如何自己制作网站班级优化大师客服电话
  • 各购物网站销售特点搜索引擎优化百度
  • 福州网站建站建设百度信息流是什么
  • 经典营销型网站百度官网认证入口
  • 做网站用别人图片文章会侵权吗长尾关键词挖掘工具爱网站
  • 公司电商网站开发合同企业网站推广公司
  • 最好的网站建设机构学生制作个人网站
  • 网站推广 排名千锋教育培训机构怎么样
  • 网站建设专员一定要会网站建设吗营销方式和营销策略
  • 网站改版会降权吗阿里云域名注册官网
  • 外贸SOHO建公司网站搜索引擎入口大全
  • 网站做关键词排名每天要做什么seo咨询岳阳
  • 网站建设的整体流程宁波seo入门教程
  • 要怎么做网站动图湖北网络推广有限公司