资源描述:
《数据结构_矩阵的压缩存储程序文件》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、word格式实验报告课程名:数据结构(C语言版)实验名:矩阵的压缩存储姓名:班级:学号:时间:2014.11.23....word格式一实验目的与要求1.掌握并实现稀疏矩阵的压缩存储的方法2.在该存储方法上实现矩阵的操作二实验内容•判断一个用二维数组存储的矩阵是不是稀疏矩阵•将其转化为压缩存储的形式•在压缩存储上实现矩阵的乘法和转置操作三实验结果与分析压缩转置程序:#include//判断该矩阵是否为稀疏矩阵#definem10#definen10inta[m][n]={{1,0,0,0,0,0,0,0,0,0},{0,0
2、,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,7,0},{0,0,0,0,0,0,8,0,0,0},{0,0,0,0,0,0,0,0,0,0},};structthree{inti,j;intvalue;};structthreestu[100];structthree1{inti,j;intvalu
3、e;};structthree1stu1[100];intjiance(){intx=0;//赋初值为0for(x=0;x<=99;x++){....word格式stu[x].value=0;}floatt=0;floatv;for(inti=0;i4、uo(){intt=0;for(intr=0;r5、tf("");}voidzhuanzhi(){intx=0;//赋初值为0intt=0;intnum[10]={0,0,0,0,0,0,0,0,0,0};//每一列非0的数目for(x=0;x<=99;x++){stu1[x].value=0;}for(intj=0;j6、]+num[j-1];}intcol=0;intq=0;for(intk=0;k7、tu1[x].i,stu1[x].j,stu1[x].value);}printf("");}voiddisplay2(){intd,b;for(d=0;d#de
8、finem13#definen14#definem24#definen22inta1[m1][n1]={{3,0,0,5},{0,-1,0,0},{2,0,0,0},};inta