正在加载图片...
Push(s, DeQueue(&Q)) 32图的邻接矩阵表示描述如下: #define maxNum 20 ∥图的最大顶点数 typedef struct( char vexs MaxNum] ∥}符类型的顶点表 nt edges[ Max Num [ MaxNum];∥邻接矩阵 /图的顶点数和边数 i MGraph; ∥图的邻接矩阵结构描述 阅读下列算法,并回答问题: (1)对于下列图G的邻接矩阵,写出函数调用F32(&G,3)的返回值: 01111 00100 00010 11000 100110 (2)简述函数f32的功能 (3)写出函数f32的时间复杂度 int f32(MGraph *G, int 1) int d=0, 5; for(=0,j<G->n,j++) if(G->edges[il[)d++ if( G->edges[l[i)d++ return d 33阅读下列算法并回答问题: (1)设数组L[18]的初值为(4,-3,7,-1,-2,2,5,-8),写出执行函数调用f33(L,8)之后的L[.8] 中的元素值 (2)简述函数f33的功能。 void f33(intR[L, int n) int low =1. high=n while(low <high) while (low<high & r[high>0) high--. f (low <high= R[low++]=R[high whilelow<high & r[low <o) low++Push(S,DeQueue(&Q)); } 32.图的邻接矩阵表示描述如下: #define MaxNum 20 //图的最大顶点数 typedef struct{ char vexs[MaxNum]; //字符类型的顶点表 int edges[MaxNum][MaxNum]; //邻接矩阵 int n, e; //图的顶点数和边数 }MGraph; //图的邻接矩阵结构描述 阅读下列算法,并回答问题: (1)对于下列图 G 的邻接矩阵,写出函数调用 F32(&G,3)的返回值;                 0 0 1 1 0 1 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 (2)简述函数 f32 的功能; (3)写出函数 f32 的时间复杂度。 int f32(MGraph *G, int i) { int d=0, j; for (j=0; j<G->n; j++) { if (G->edges[i][j])d++; if( G->edges[j][i])d++; } return d; } 33.阅读下列算法并回答问题: (1)设数组 L[1..8]的初值为(4,-3,7,-1,-2,2,5,-8),写出执行函数调用 f33(L,8)之后的 L[1..8] 中的元素值; (2)简述函数 f33 的功能。 void f33(intR[ ],int n) { int x =R [1]; int low =1, high=n; while (low<high) { while (low<high && R[high]>0) high--; if (low<high= { R[low++]=R[high]; while (low<high && R[low] <0) low++;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有