1.设计一个算法将无向图的邻接矩阵转为对应邻接表的算法。typedefstruct{intvertex[m];intedge[m][m];}gadjmatrix;typedefstructnode1{intinfo;intadjvertex;structnode1*nextarc;}glinklistnode;typedefstructnode2{intvertexinfo;glinklistnode*firstarc;}glinkheadnode;voidadjmatrixtoadjlist(gadjmatrixg1[],glinkheadnodeg2[]){inti,j;glinklistnode*p;for(i=0;i=n-1;i++)g2[i].firstarc=0;for(i=0;i=n-1;i++)for(j=0;j=n-1;j++)if(g1.edge[i][j]==1){p=(glinklistnode*)malloc(sizeof(glinklistnode));p-adjvertex=j;p-nextarc=g[i].firstarc;g[i].firstarc=p;p=(glinklistnode*)malloc(sizeof(glinklistnode));p-adjvertex=i;p-nextarc=g[j].firstarc;g[j].firstarc=p;}}设计判断两个二叉树是否相同的算法。typedefstructnode{datatypedata;structnode*lchild,*rchild;}bitree;intjudgebitree(bitree*bt1,bitree*bt2){if(bt1==0&&bt2==0)return(1);elseif(bt1==0||bt2==0||bt1-data!=bt2-data)return(0);elsereturn(judgebitree(bt1-lchild,bt2-lchild)*judgebitree(bt1-rchild,bt2-rchild));}1.设计两个有序单链表的合并排序算法。voidmergelklist(lklist*ha,lklist*hb,lklist*&hc){lklist*s=hc=0;while(ha!=0&&hb!=0)if(ha-datahb-data){if(s==0)hc=s=ha;else{s-next=ha;s=ha;};ha=ha-next;}else{if(s==0)hc=s=hb;else{s-next=hb;s=hb;};hb=hb-next;}if(ha==0)s-next=hb;elses-next=ha;}1.下面程序段的功能是实现在二叉排序树中插入一个新结点,请在下划线处填上正确的内容。typedefstructnode{intdata;structnode*lchild;structnode*rchild;}bitree;voidbstinsert(bitree*&t,intk){if(t==0){_t=(bitree*)malloc(sizeof(bitree));t-data=k;t-lchild=t-rchild=0;}elseif(t-datak)bstinsert(t-lchild,k);elsebstinsert(t-rchild,k);}