[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-685768-105":59,"doc-detail-685768-en":130,"doc-similar-685768":165},{"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","cs-2351-data-structures-linked-lists","CS 2351 Data Structures - Linked Lists","","Lecture notes for CS 2351 Data Structures focusing on linked lists. The material contrasts C/C++ C-type contiguous arrays with linked-list representations, explaining insertion and deletion tradeoffs. It introduces singly linked lists (SLL) via node concepts, including how each node stores a data field and a link (pointer) to the next node. Step-by-step SLL insertion and deletion examples show how updates to link fields avoid shifting or moving existing nodes, emphasizing the practical mechanics of dynamic sequence management.",{"@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":20,"@type":76,"position":81},"https://docshare.wps.com/document/exam/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/cs-2351-data-structures-linked-lists/685768/",{"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/cs-2351-data-structures-linked-lists/685768.png","ImageObject",300,407,{"name":92,"@type":93},"\tJames","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-19","2026-11-07",true,{"@type":102,"interactionType":103,"userInteractionCount":52},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"Why are arrays inefficient for insertion or deletion at arbitrary positions?","Question",{"text":112,"@type":113},"Inserting a new element into the middle of an array requires shifting many elements to keep the order, which becomes expensive for arbitrary locations.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"What is a linked list representation and how does it differ from arrays?",{"text":117,"@type":113},"In a linked list, elements (nodes) are not stored contiguously. Each node keeps an explicit link (pointer) to reach the next node instead of relying on contiguous memory.",{"name":119,"@type":110,"acceptedAnswer":120},"How does singly linked list insertion avoid shifting nodes?",{"text":121,"@type":113},"Insertion creates a new node, sets its link to the target’s next node, and then updates the previous node’s link to point to the new node, without moving existing nodes.","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},685768,1794017950,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":19,"category_name":20,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":52,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":139,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":129,"read_time":144,"preview_page_count":24,"preview_urls":145},2336474466412,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","CS 2351 Data Structures  \nLinked Lists  \nProf. Chung-Ta King  \nDepartment of Computer Science National Tsing Hua University  \nOutline  \n􀁺 Singly linked lists and chains (Sec. 4.1)  \n􀁺 C++ representation of chains (Sec. 4.2)  \n􀁺 The template class chain (Sec. 4.3)  \n– C++ Iterator  \n􀁺 Circular lists and doubly linked lists (Sec. 4.4, 4.10)  \nNational Tsing Hua University  \n2  \nReview of C-type Arrays  \n􀁺 When you declare an array in C or C++  \nint L[100];  \nyou conceptually envision a contiguous space of 100 integers, with each element stored next to another – Ex.: layout of L = {a,b,c,d,e} in an array representation  \n a b c d e   \n– Actually, this is how the array is usually stored in the computer memory (each block above is a memory location)  \nNational Tsing Hua University  \n3  \nContiguous Space for Storing Arrays  \n􀁺 Pros:  \n– Adequate for special data structures like stack and queue  \n– Efficient to insert/delete from the ends  \n– Suitable for random accesses  \n– Good for the types of data structures discussed in the previous two chapters, e.g. polynomial addition, sparse matrix transpose, stack, queue, etc.  \n􀁺 Cons:  \n– Difficult to insert/delete elements at arbitrary locations  \nNational Tsing Hua University  \n4  \nInsertion/Deletion in an Array  \n􀁺 Suppose we have an array that stores 3-letter words in their alphabetic order  \n􀁺 Given a new word “GAT”, we would certainly like it to be inserted between “FAT” and “HAT”  \n– This would require shifting either “BAT” … “FAT” left or“HAT” … “MAT” right; both are expensive operations  \nNational Tsing Hua University  \n5  \nAny Alternative?  \n􀁺 Linked list representation  \nL e a d b c  \n– List elements are stored in memory in an arbitrary order  \n– Explicit information (called a link) is used to go from one element to the next  \nNational Tsing Hua University  \n6  \nLinked List Representation  \n􀁺 Nodes are no longer contiguous in the memory  \n􀁺 Each node stores address or location of the next one  \n􀁺 Singly Linked List (SLL)  \n– Each node has exactly one pointer (link) field  \nfirst  \na0  \nData field  \nNode  \nLink field  \nChain  \nNational Tsing Hua University  \n7  \nSLL Operation: Insertion  \n􀁺 Steps to do when we want to insert ”EAT” inbetween “CAT” and “FAT”  \n– Create a new node “a” and set data field to “EAT”  \n– Set the link field of “a” to “FAT” node  \n– Set the link field of “CAT” node to “a”first  \nYou do not need to move or shift any node!  \nNational Tsing Hua University  \n8  \nSLL Operation: Deletion  \n􀁺 Steps to do when we want to delete ”EAT” from the list  \n– Locate the node “a” precedes the “EAT” node  \n– Set the link field of “a” to the node next to “EAT” node  \n– Delete the “EAT” node  \n…  \nfirst  \na  \nYou do not need to move or shift any node!  \nNational Tsing Hua University  \n9  \nOutline  \n􀁺 Singly linked lists and chains (Sec. 4.1)  \n􀁺 C++ representation of chains (Sec. 4.2)  \n􀁺 The template class chain (Sec. 4.3)  \n– C++ Iterator  \n􀁺 Circular lists and doubly linked lists (Sec. 4.4, 4.10)  \nNational Tsing Hua University  \n10","cbCaihf12x8hSWzA","https://ap.wps.com/l/cbCaihf12x8hSWzA","pdf",5102991,41,"English","# Outline\n## Singly linked lists and chains\n## C++ representation of chains\n## The template class chain\n## C++ Iterator\n## Circular lists and doubly linked lists\n## Review of C-type arrays\n## Contiguous space for storing arrays\n## Insertion/Deletion in an array\n## Any alternative? Linked list representation\n## Linked list representation\n## SLL operation: insertion\n## SLL operation: deletion","[{\"question\":\"Why are arrays inefficient for insertion or deletion at arbitrary positions?\",\"answer\":\"Inserting a new element into the middle of an array requires shifting many elements to keep the order, which becomes expensive for arbitrary locations.\"},{\"question\":\"What is a linked list representation and how does it differ from arrays?\",\"answer\":\"In a linked list, elements (nodes) are not stored contiguously. Each node keeps an explicit link (pointer) to reach the next node instead of relying on contiguous memory.\"},{\"question\":\"How does singly linked list insertion avoid shifting nodes?\",\"answer\":\"Insertion creates a new node, sets its link to the target’s next node, and then updates the previous node’s link to point to the new node, without moving existing nodes.\"}]","CS 2351 Data Structures - Linked Lists | PDF",103,[146,150,154,158,162],{"page_no":8,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/11df08b2b338a15b6061d5e07942c68a.webp",983,737,{"page_no":14,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/e9a8af18464b84caa73cdfaaf161acbe.webp",982,736,{"page_no":81,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/a9573a1beb52447b2e6e08a25d1f1083.webp",981,735,{"page_no":19,"url":159,"width":160,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/7480582eb07cbe730147aa5dff77efd6.webp",980,734,{"page_no":24,"url":163,"width":164,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/c58203881ebbe3ffb214a9cae68f1dc4.webp",979,{"list":166,"token":66},[167,173,179,185,191,197,203,210,216,223],{"doc_id":168,"doc_title":169,"file_type":137,"home_preview_img_url":170,"slug":171,"view_count":81,"category_name":20,"create_tm":172},732882,"Linked Lists in MIPS - MIPS Implementation, Recursive Functions, ISA and x86 vs MIPS Comparison","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031413521/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=lXQoIAaMq1jH945THcYdVOyCEVs%3D","linked-lists-in-mips-mips-implementation-recursive-functions-isa-and-x86-vs-mips-comparison",1795382683,{"doc_id":174,"doc_title":175,"file_type":137,"home_preview_img_url":176,"slug":177,"view_count":44,"category_name":20,"create_tm":178},685668,"C++ Linked Lists - Review - List Operations and Traversal","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000175845/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=NjrCF71xLlPvfzyeTj0ZwUK0U1c%3D","c-linked-lists-review-list-operations-and-traversal",1794016536,{"doc_id":180,"doc_title":181,"file_type":137,"home_preview_img_url":182,"slug":183,"view_count":29,"category_name":20,"create_tm":184},697956,"Linked List - Lecture 23-24 - Notes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010142265/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=dsecB0QZ3i%2Fv3LjNO2MzEB9IdA8%3D","linked-list-lecture-23-24-notes",1794446335,{"doc_id":186,"doc_title":187,"file_type":137,"home_preview_img_url":188,"slug":189,"view_count":19,"category_name":20,"create_tm":190},697940,"Doubly Linked Lists - Part 10 - Doubly Linked Lists and Java Collections","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010136498/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=m5D5%2BkXob8bHyizExnAQzv0TGsw%3D","doubly-linked-lists-part-10-doubly-linked-lists-and-java-collections",1794446070,{"doc_id":192,"doc_title":193,"file_type":137,"home_preview_img_url":194,"slug":195,"view_count":19,"category_name":20,"create_tm":196},697947,"Linked List in Python - Lecture 4 - Implementation","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010140976/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=aK79fyW7AMLk4Hge3DWp6e40zjs%3D","linked-list-in-python-lecture-4-implementation",1794446273,{"doc_id":198,"doc_title":199,"file_type":137,"home_preview_img_url":200,"slug":201,"view_count":39,"category_name":20,"create_tm":202},685761,"Singly-Linked List Class - Exam 1 - Review and HW5 Card Game Efficiency","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999691124/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=NoxPSMP2pCFhnTT8o9B%2BxbUy%2B%2FY%3D","singly-linked-list-class-exam-1-review-and-hw5-card-game-efficiency",1794017629,{"doc_id":204,"doc_title":205,"file_type":137,"home_preview_img_url":206,"slug":207,"view_count":208,"category_name":20,"create_tm":209},391408,"Genpact Interview Questions for Freshers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917680893/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=aimaRMipjza3aQXf1TXlSIovZ3E%3D","genpact-interview-questions-for-freshers",21,1790353128,{"doc_id":211,"doc_title":212,"file_type":137,"home_preview_img_url":213,"slug":214,"view_count":52,"category_name":20,"create_tm":215},685729,"Chapter 14 Linked Lists - Chapter 14 - Operations and Implementations of Singly Linked Lists","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000185871/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=EySTvfET46NnyPpTVxThySw9IpM%3D","chapter-14-linked-lists-chapter-14-operations-and-implementations-of-singly-linked-lists",1794017196,{"doc_id":217,"doc_title":218,"file_type":137,"home_preview_img_url":219,"slug":220,"view_count":221,"category_name":20,"create_tm":222},391772,"71 C++ Interview Questions to Ask Your Applicants","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917705862/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=sM%2BKUcCDiUDMMjXQ4LiDNkbwRnc%3D","71-c-interview-questions-to-ask-your-applicants",15,1790358624,{"doc_id":224,"doc_title":225,"file_type":137,"home_preview_img_url":226,"slug":227,"view_count":44,"category_name":20,"create_tm":228},670584,"Java Data Structures Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988344079/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=sVRQYb00loe8eRWKl7%2BaUPD14Dk%3D","java-data-structures-cheat-sheet",1793570142]