《城市链表实验报告.pdf》由会员分享,可在线阅读,更多相关《城市链表实验报告.pdf(10页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、城市链表实验报告2014-2015学年第一学期实验报告课程名称:算法与数据结构实验名称:城市链表一、实验目的本次实验的主要目的在于熟悉线性表的基本运算在两种存储结构上的实现,其中以熟悉各种链表的操作为侧重点。同时,通过本次实验帮助学生复习高级语言的使用方法。二、实验内容(一)城市链表:将若干城市的信息,存入一个带头结点的单链表。结点中的城市信息包括:城市名,城 市的位置坐标。要求能够利用城市名与位置坐标进行有关查找、插入、删除、更新等操作。(二)约瑟夫环m 的初值为20;密码:3,1,7,2,6,8,4(正确的结果应为6,1,4,7,2,3,5)。三、实验环境VS2010、win8、1 四、实
2、验结果(一)城市链表:(1)创建城市链表;(2)给定一个城市名,返回其位置坐标;(3)给定一个位置坐标P 与一个距离D,返回所有与P 的距离小于等于D 的城市。(4)在已有的城市链表中插入一个新的城市;(5)更新城市信息;(6)删除某个城市信息。(二)约瑟夫环m 的初值为20;密码:3,1,7,2,6,8,4 输出6,1,4,7,2,3,5。五、附录城市链表:5、1 问题分析该实验要求对链表实现创建,遍历,插入,删除,查询等操作,故使用单链表。5、2 设计方案该程序大致分为以下几个模块:1、创建城市链表模块,即在空链表中插入新元素。故创建城市链表中包涵插入模块。城市链表实验报告2、返回位置坐标
3、模块。3、计算距离模块4、插入模块。5、更新城市信息模块6、删除信息模块。5、3 算法5、3、1 根据中心城市坐标,返回在距离内的所有城市:void FindCityDistance(citylist*L)/根据距离输出城市/输入信息与距离L=L-next;while(L !=NULL)if(L-x-x1)*(L-x-x1)+(L-y-y1)*(L-y-y1)x-x1)+(L-y-y1)!=0)printf(城市名称%sn,L-Name);printf(城市坐标%、2lf,%、2lfn,L-x,L-y);L=L-next;该算法主要用到了勾股定理,考虑到不需要实际数值,只需要大小比较,所以只用
4、横坐标差的平方+纵坐标差的平方 next=NULL;void Insert_sqCity(citylist*L)/在链表中插入元素citylist*newNode;newNode=(citylist*)malloc(sizeof(citylist);if(!newNode)printf(存储分配失败);printf(请输入城市名 n);scanf(%s,newNode-Name);printf(请输城市坐标 x yn);scanf(%lf%lf,&(newNode-x),&(newNode-y);while(L-next!=NULL)L=L-next;/如果非空,L 指针的位置向后移newNo
5、de-next=L-next;L-next=newNode;void Create_sqCity(citylist*L)/创建链表char ch100;int i;printf(输入 END 退出,输入其余值继续 n);/当输入 END 时,在任意输入,则退出此操作scanf(%s,ch);for(;strcmp(ch,END)!=0;)Insert_sqCity(L);printf(输入 END 退出,输入其余值继续 n);scanf(%s,ch);创建查询插入删除更新距离退出就 是 否 退出就是结束开始选择操作否文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O
6、6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编
7、码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10
8、R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9
9、Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1
10、I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8
11、G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR
12、4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7城市链表实验报告 void Get_sqCityCoord(citylist*L)/输入城市信息返回坐标char ch10;printf(输入要查询的城市 );scanf(%s,ch);while(L-next!=NULL&strcmp(L-ne
13、xt-Name,ch)L=L-next;if(L-next=NULL)printf(城市不存在);else printf(%、2lf,%、2lfn,L-next-x,L-next-y);void Delete_sqCity(citylist*L)/删除城市信息 ,按名称/坐标printf(请输入城市名 n);char ch10;scanf(%s,ch);while(L-next!=NULL&strcmp(L-next-Name,ch)L=L-next;if(L-next=NULL)printf(城市不存在 );/删除位置不合理L-next=L-next-next;printf(删除城市成功 )
14、;void FindCityDistance(citylist*L)/根据距离输出城市printf(输入中心城市坐标);double x1,y1;scanf(%lf%lf,&x1,&y1);printf(输入距离);double dis;scanf(%lf,&dis);L=L-next;while(L !=NULL)if(L-x-x1)*(L-x-x1)+(L-y-y1)*(L-y-y1)x-x1)+(L-y-y1)!=0)printf(城市名称%sn,L-Name);printf(城市坐标%、2lf,%、2lfn,L-x,L-y);文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10
15、 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8
16、I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7
17、文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:C
18、C10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q
19、3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4
20、HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P
21、8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7城市链表实验报告L=L-next;void Update_sqCity(citylist*L)/更新城市信息char ch10;printf(请输入您要更新的城市名n);scanf(%s,ch);while(strcmp(L-n
22、ext-Name,ch)L=L-next;if(L-next=NULL)printf(城市不存在 n);printf(请输入城市新信息:n);printf(请输入城市新名 n);scanf(%s,L-next-Name);printf(请输入城市新坐标 n);scanf(%lf%lf,&(L-next-x),&(L-next-y);int main()citylist*L;L=(citylist*)malloc(sizeof(citylist);InitList_SqCity(L);for(;)printf(-n);printf(请选择您的操作 n);printf(1、创建城市链表 n);pr
23、intf(2、根据名字查询城市 n);printf(3、插入 n);printf(4、删除 n);printf(5、更新城市信息 n);printf(6、根据离中心坐标距离查瞧城市n);printf(7、退出系统 n);printf(-n);int choice;scanf(%d,&choice);switch(choice)case 1:Create_sqCity(L);getchar();break;case 2:Get_sqCityCoord(L);break;文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I
24、4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G
25、10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4
26、G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6
27、Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码
28、:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R
29、7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q
30、4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7城市链表实验报告case 3:Insert_sqCity(L);break;case 4:Delete_sqCity(L);break;case 5:Update_sqCity(L);break;case 6:FindCityDistance(L);break;case 7:break;if(c
31、hoice=7)break;5、6 仿真结果2、查询城市信息3 添加城市文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q
32、3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4
33、HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P
34、8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10
35、 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8
36、I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7
37、文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7城市链表实验报告4 删除城市5 更新城市6 根据距离输出城市5、7 调试心得5、7、1 错误分析
38、:实验中出现的第一个问题就是声明变量,从键盘中读入数据就是显示变量未初始化,调试后发现就是scanf 的问题,以后的实验中应注意scanf 中读入信息后就是存到了地址里。5、7、2 算法复杂度的分析:所有程序除了InitList_SqCity 复杂度为 O(1),其余均为 O(n)。5、7、3 收获对数据结构这门课地应用有了一定地了解,知道对线性表插入、删除等操作的实现,加深对课本地理解。附录约瑟夫环:5、1 问题分析文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:
39、CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7
40、Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4
41、 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4
42、P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G1
43、0 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G
44、8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q
45、7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7城市链表实验报告该实验要求循环连续查找信息,并删除节点,故使用单项循环链表。5、2 设计方案1、建立单循环链表2、产生 Joseph环3、输出顺序表5、3 算法5、3、1 构成单链表void Creat_JoephLink(int num)Node*head,*q,*L;L=(Node*)malloc(sizeof(Node);/申请第一个数的
46、节点head=L;L-num=1;printf(输入第一个人的值:);/输入第一个人的值 scanf(%d,&(L-value);int i;for(i=2;inext=q;L=q;printf(输入第%d个人的值:,i);/输入每个人的值scanf(%d,&(L-value);L-num=i;L-next=head;L=head;/构成单向循环链表 5、3、2 查找并删除节点Status Delete_Node(Node*L)for(j=1;j=num;j+)for(i=1;inext;m=L-value;/将当前值设为m值printf(%d ,L-num);/输出当前节点信息/删除当前节点
47、L-num=L-next-num;L-value=L-next-value;q=L-next;L-next=L-next-next;free(q);5、4 源程序代码typedef struct Node 文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G1
48、0 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G
49、8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q
50、7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码:CC10R7Q3R9Q4 HU1I4P8O8G10 ZR4G8I8O6Q7文档编码: