[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-732876-105":59,"doc-detail-732876-en":130,"doc-similar-732876":161},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","lecture-10-linked-lists-lecture-notes","Lecture 10 - Linked Lists - Lecture notes","","Lecture notes explaining how linked lists implement stack and queue interfaces, supporting work lists of arbitrary length and highlighting trade-offs versus arrays. The document defines linked-list node structures in C0 using recursive types with pointers and NULL as an end marker, including alternatives that avoid explicit NULL in certain applications. It then introduces list segments using inclusive-lower, exclusive-upper bounds and shows how to check segment existence via traversal, including recursive and iterative approaches.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/lecture-10-linked-lists-lecture-notes/732876/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/lecture-10-linked-lists-lecture-notes/732876.png","ImageObject",300,407,{"name":92,"@type":93},"Mary Man","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-27","2026-11-22",true,{"@type":102,"interactionType":103,"userInteractionCount":19},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"How do linked lists help implement stacks and queues?","Question",{"text":112,"@type":113},"Linked lists implement the stack and queue interfaces so the resulting work lists can grow to any length.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"What is the core structure of a linked-list node in C0 as described?",{"text":117,"@type":113},"A node is a struct containing data of type elem and a pointer next to another node. The example uses struct list_node with next as a pointer to the same struct type.",{"name":119,"@type":110,"acceptedAnswer":120},"What does an empty list segment mean under the inclusive-lower, exclusive-upper definition?",{"text":121,"@type":113},"If start and end are the same pointer (for example, a segment from l to l), the segment is empty because the data in the last node end is excluded from the segment.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},732876,1795382672,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":19,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":41,"language":139,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":67,"update_tm":129,"read_time":143,"preview_page_count":19,"preview_urls":144},7421720224475,"https://ap-avatar.wpscdn.com/davatar_276721f389ce27ea32af1340a28f341c","Lecture 10  \nLinked Lists  \n15-122: Principles of Imperative Computation (Fall 2026) Frank Pfenning, Rob Simmons, André Platzer, Iliano Cervesato  \nIn this lecture we discuss the use of linked lists to implement the stack and queue interfaces that were introduced in the last lecture. The linked list implementation of stacks and queues allows us to handle work lists of any length.  \nAdditional Resources  \n􀀏 Review slides ( [https://cs](https://cs) . cmu . edu/~15122/handouts/slides/review/10-linkedlist .  \npdf)  \n􀀏 Code for this lecture ( [https://cs](https://cs) . cmu . edu/~15122/handouts/code/10-linkedlist .  \ntgz)  \nThis ﬁts as follows with respect to our learning goals:  \nComputational Thinking: We discover that arrays contain implicit information, namely the indices of elements, which an be made explicit asthe addresses of the nodes of a linked list. We also encounter the notion of trade-off, as arrays and linked lists have different advantagesand drawbacks and yet achieve similar purposes.  \nAlgorithms and Data Structures: We explore linked lists, a data structure used pervasively in Computer Science, and examine some basic algorithms about them.  \nProgramming: We see that programming algorithms for linked lists can be tricky, which exposes once more the power of stating and checking invariant. We use linked lists to implement stacks and queues.  \n1 Linked Lists  \nLinked lists are a common alternative to arrays in the implementation of data structures. Each item in a linked list contains a data element of some type and a pointer to the next item in the list. It is easy to insert and delete  \nLECTURE NOTES  \n􀀍c Carnegie Mellon University 2026  \nelements in a linked list, which are not natural operations on arrays, since arrays have a ﬁxed size. On the other hand access to an element in the middle of the list is usually O (n), where n is the length of the list.  \nAn item in a linked list consists of a struct containing the data element and a pointer to another linked list. In C0 we have to commit to the typeof element that is stored in the linked list. We will refer to this data as having type elem, with the expectation that there will be a type deﬁnition elsewhere telling C0 what elem is supposed to be. Keeping this in mind ensures that none of the code actually depends on what type is chosen. These considerations give rise to the following deﬁnition:  \nstruct list_node { elem data;  \nstruct list_node * next;};  \ntypedef struct list_node list;  \nThis deﬁnition is an example of a recursive type. A struct of this type contains a pointer to another struct of the same type, and so on. We usually use the special element of type t *, namely NULL, to indicate that we have reached the end of the list. Sometimes (as will be the case for our use of linked lists in stacks and queues), we can avoid the explicit use of NULL and obtain more elegant code. The type deﬁnition is there to create the typename list, which stands for struct list_node, so that a pointer to a list node will be list * . We could also have written these two statements in the other order, to make better use of the type deﬁnition:  \ntypedef struct list_node list;  \nstruct list_node { elem data;  \nlist * next;};  \nThere are some restriction on recursive types. For example, a declaration such as  \nstruct infinite { int x;  \nstruct infinite next;}  \nwould be rejected by the C0 compiler because it would require an inﬁnite amount of space. The general rule is that a struct can be recursive, but the recursion must occur beneath a pointer or array type, whose values are addresses. This allows a ﬁnite representation for values of the struct type.  \nWe don't introduce any general operations on lists; let's wait and see what we need where they are used. Linked lists as we use them here area concrete type which means we do not construct an interface and a layer of abstraction around them. When we use them we know about and exploit their precise internal structure. This is in ","cbCaioTppOykW3f2","https://ap.wps.com/l/cbCaioTppOykW3f2","pdf",696984,"English","# 1 Linked Lists\n## Node structure and recursive types\n## Concrete vs abstract types\n# 2 List segments\n## Inclusive-lower, exclusive-upper bounds\n## Checking segment membership","[{\"question\":\"How do linked lists help implement stacks and queues?\",\"answer\":\"Linked lists implement the stack and queue interfaces so the resulting work lists can grow to any length.\"},{\"question\":\"What is the core structure of a linked-list node in C0 as described?\",\"answer\":\"A node is a struct containing data of type elem and a pointer next to another node. The example uses struct list_node with next as a pointer to the same struct type.\"},{\"question\":\"What does an empty list segment mean under the inclusive-lower, exclusive-upper definition?\",\"answer\":\"If start and end are the same pointer (for example, a segment from l to l), the segment is empty because the data in the last node end is excluded from the segment.\"}]","Lecture 10 - Linked Lists - Lecture notes | PDF",76,[145,149,153,157],{"page_no":8,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/b66aea57bcdeb6c9bdda1be4b07c2211.webp",983,1272,{"page_no":14,"url":150,"width":151,"height":152},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/436f6f0b25a519cbf52dce0391d2ae1b.webp",982,1270,{"page_no":81,"url":154,"width":155,"height":156},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/0236728b9fbf25d2de8307c427e193f9.webp",981,1269,{"page_no":19,"url":158,"width":159,"height":160},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/93f0d488e10d1a9e9f01aab615ef0ea7.webp",980,1268,{"list":162,"token":66},[163,169,175,181,187,193,199,205,211,217],{"doc_id":164,"doc_title":165,"file_type":137,"home_preview_img_url":166,"slug":167,"view_count":81,"category_name":30,"create_tm":168},732874,"Unit11-Linked Lists","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031780339/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=Dy0P5AZ7eUw%2FPkBaPqlYm4f%2Bywc%3D","unit11-linked-lists",1795382671,{"doc_id":170,"doc_title":171,"file_type":137,"home_preview_img_url":172,"slug":173,"view_count":24,"category_name":30,"create_tm":174},685741,"ROHINI COLLEGE OF ENGINEERING & TECHNOLOGY - Linked list implementation - Singly linked lists - Core algorithms for traversal, counting, searching and insertion","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000186201/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=HIm4iuBcwZNCUtedNQzfFUpHu50%3D","rohini-college-of-engineering-technology-linked-list-implementation-singly-linked-lists-core-algorithms-for-traversal-counting-searching-and-insertion",1794017223,{"doc_id":176,"doc_title":177,"file_type":137,"home_preview_img_url":178,"slug":179,"view_count":24,"category_name":30,"create_tm":180},685730,"Chapter 4 Linked Lists - 4.1 Singly Linked Lists Or Chains","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000185878/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=0lrZtHDeE7vkiS7ZoKb8se0tKFI%3D","chapter-4-linked-lists-41-singly-linked-lists-or-chains",1794017203,{"doc_id":182,"doc_title":183,"file_type":137,"home_preview_img_url":184,"slug":185,"view_count":34,"category_name":30,"create_tm":186},697943,"Lecture 12 Doubly Linked Lists - (with Recursion)","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230009212198/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=%2Fn3BmyachurHlHhrVjzeWWddq4A%3D","lecture-12-doubly-linked-lists-with-recursion",1794446071,{"doc_id":188,"doc_title":189,"file_type":137,"home_preview_img_url":190,"slug":191,"view_count":34,"category_name":30,"create_tm":192},685760,"CS62 Class 8 - Linked lists - Basic Data Structures","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000192614/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=TLrkErTVglva7eNvU1IvTNNb6eM%3D","cs62-class-8-linked-lists-basic-data-structures",1794017629,{"doc_id":194,"doc_title":195,"file_type":137,"home_preview_img_url":196,"slug":197,"view_count":19,"category_name":30,"create_tm":198},732878,"Linked Lists - Overview - Advantages and Operations","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031780342/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=G2WizA1MLNYUHV3n74mL3OuIYnA%3D","linked-lists-overview-advantages-and-operations",1795382677,{"doc_id":200,"doc_title":201,"file_type":137,"home_preview_img_url":202,"slug":203,"view_count":24,"category_name":30,"create_tm":204},685782,"1.4.2 - Data Structures - Advanced Notes - Specification","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000208907/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=Y%2BklJoJ0F%2BAtYUOqY0yXyY5bQoA%3D","142-data-structures-advanced-notes-specification",1794018468,{"doc_id":206,"doc_title":207,"file_type":137,"home_preview_img_url":208,"slug":209,"view_count":19,"category_name":30,"create_tm":210},685722,"Linked List Basics - read and practice","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000182486/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=Wod3POn7ZgJ0eVUFUEgvFBH8%2FSI%3D","linked-list-basics-read-and-practice",1794016978,{"doc_id":212,"doc_title":213,"file_type":137,"home_preview_img_url":214,"slug":215,"view_count":24,"category_name":30,"create_tm":216},685716,"Linked Lists - Introduction - Properties, Advantages, Disadvantages, and Types","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999688533/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=Peja5X3hBkExLWpbXAxmPuNlnP8%3D","linked-lists-introduction-properties-advantages-disadvantages-and-types",1794016969,{"doc_id":218,"doc_title":219,"file_type":137,"home_preview_img_url":220,"slug":221,"view_count":81,"category_name":30,"create_tm":222},719597,"Chapter 15 - Linked Data Structures - Java Linked Lists - Key Concepts","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230023815525/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=bVSiPm5ZK3B3x0F3Zf8MkyjpWLk%3D","chapter-15-linked-data-structures-java-linked-lists-key-concepts",1795006731]