自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(0)
  • 资源 (1)
  • 收藏
  • 关注

空空如也

数据结构(c语言实现)

数据结构 /*校园共7个结点*/ #include <stdio.h> #include <stdlib.h> #define MAXSIZE 50 #define MAXINT 32700/*试着用32767,在算法中再+时,就会溢出出错*/ typedef int datatype; typedef struct { datatype vexs[MAXSIZE]; int edges[MAXSIZE][MAXSIZE]; int n,e; }Graph; void CreateGraph(Graph *graph) { /*按照图,手工建立邻接矩阵。然后写入程序*/ int i,j; graph->n=7; graph->e=10; /*所有数组从下标1开始使用,这是为了和顶点表示统一*/ for(i=1;i<=graph->n;i++) graph->vexs[i]=i; for(i=1;i<=graph->n;i++) for(j=1;j<=graph->n;j++) { graph->edges[i][j]=MAXINT;/*缺省值均为无穷大*/ if(i==j) graph->edges[i][j]=0; } graph->edges[1][2]=20; graph->edges[1][3]=10; graph->edges[1][4]=30; graph->edges[2][7]=9; graph->edges[3][5]=5; graph->edges[5][4]=12; graph->edges[5][7]=15; graph->edges[6][5]=8; graph->edges[6][7]=10; graph->edges[7][3]=18; } void PrintGraph(Graph *graph) { int i,j; printf(" "); for(j=1;j<=graph->n;j++) printf("%6d ",j);/*限定打印输出固定长度*/ printf("\n"); for(i=1;i<=graph->n;i++) { printf("%d ",i); for(j=1;j<=graph->n;j++) printf("%6d ",graph->edges[i][j]); printf("\n"); }

2009-10-13

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除