- 1、本文档共35页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
七 链表(ying)
2.3 linked lists The drawback of the static date structure 1.Once memory space is allocated for the array, it cannot be extended. 2.If some data item has to be inserted or if some data has to be removed from the array in the middle,bconsiderable amount of date of data movement occurs. this data movement consumes computer time and decreases program efficiency. To overcome this problem of static data structure,,a linked –list data structure is used. Linked-lists In the linked-list data structure, the elements need not be stored in consecutive memory locations. The memory space allocated for the elements of the list can be extended at any time. Each element will have two types of fields, namely, data fields and pointer fields. data fields have the actual data, the pointer fields has the address of the next element. Definition A linked list is an order collection of finite homogeneous data elements called nodes where the linear order is maintained by means of links or pointers. The number of pointers are maintained depending on the requirements and usage.based on this ,linked lists are classified into three categories: Singly linked list Doubly linked list Circularly linked list Singly linked list 2.3.2 basic operations 【2.6】InsertFirstLinkList Creat_LinkList1( ){ LinkList H=(LinkList)malloc(sizeof(LNode)); /* 生成头结点 */ H -next=NULL; /* 空表 */ LNode *s; int x; /* 设数据元素的类型为int */ scanf("%d",x); while (x!=-1) { s=(LinkList)malloc(sizeof(LNode)); s-data=x; s-next=H-next; H-next=s; scanf ("%d",x); } return H ; } (2)Inserts a node after the last node of the linked list (16,20,65,12) 【2.7】InsertLast The length of list 算法思路:设一个指针p和计数器j,初始化使p指向头结点H,j=0。若p所指结点还有后继结点,p向后移动,计数器加 1,重复上述过程,直到p-next==NULL为止。 【算法2.8】设H是带头结点的单链表,求带头结点单链表的表长。 Status Length_LinkList (LinkList H) { LNode * p= H ; int j=0; while(p-next) { p=p-next; j++; } return j; } 4.Insertion of a node int I
您可能关注的文档
- 一年级语文ie ve er课件改.ppt
- 一次函数的分段函数的解析式的求法.ppt
- 一次函数应用题和分段函数.doc
- 一次函数的图像和性质分段函数.ppt
- 一次函数的应用——行程问题-解析及答案(北师大版八年级数学).docx
- 一次函数的性质(一).ppt
- 一日一练:牛顿运动定律、动能定理与动量守恒定律(卢尚明).doc
- 一期S C型施工升降机安装方案.doc
- 一年级汉语拼音iuü部编.ppt
- 一种汽车加油口盖板.doc
- 2025年市总工会党组书记、市委组织部部长生活会“四个带头”个人对照检查发言材料2篇(含上年度整改+个人情况、个人事项+典型案例).docx
- 2025年部编版小学六年级下册《道德与法治》第四单元 让世界更美好第10课 我们爱和平教学课件.pptx
- 公司领导班子2025年围绕“四个带头”主题检视问题整改落实方案与组织生活会批评意见(20条)2篇文.docx
- 教育系统党组班子2025年对照“四个带头”含意识形态、以典型案例举一反三解析检视材料【2篇文】.docx
- 2025年国有企业领导班子、学校副校长生活会“四个带头”方面对照个人检视发言材料2篇文(附:上年度整改情况、典型案例解析).docx
- 2025年生活会“四个带头”个人对照检查材料2篇文(含对其他领导批评意见,个人公开事项申报、意识形态).docx
- 2025年国有企业党委书记、领导班子生活会“四个带头”方面对照检查发言材料2篇文(上年度整改情况).docx
- 乡镇领导班子、市委组织部常务副部长2025年对照“四个带头”含违纪行为为典型案例的剖析与反思检视剖析材料{2篇文}.docx
- 市委社会工作部2025年生活会领导班子对照检视发言材料2篇文(含以案为鉴,深刻反思存在问题、反面典型案例举一反三解析、其他需要说明情况).docx
- 2025年民主生活会、组织生活会批评意见(20条)与市直单位领导班子“四个带头”对照检查材料【含上年度查摆问题整改落实情况】2篇文.docx
最近下载
- 2025年辽宁医药职业学院单招职业技能测试题库及答案(易错题).docx VIP
- 学习资料 工程造价 2020版云南省建筑工程计价标准(上、下).pdf
- 2025年预拌混凝土管理办法 .pdf VIP
- 标准图集-20S515-钢筋混凝土及砖砌排水检查井.pdf VIP
- 2024-2025学年小学信息技术(信息科技)六年级下册川教版(2019)教学设计合集.docx
- AVR单片机思考题及答案_AVR期末复习题.doc VIP
- 《水旱灾害防御体系建设导则》.pdf
- 幼儿园大班数学《认识日历》课件(2022版加背景图片).pptx
- 中国远洋应收账款案例分析.pdf
- 《热爱中国共产党》教学设计(第二课时) (1).docx VIP
文档评论(0)