[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-685766-105":59,"doc-detail-685766-en":130,"doc-similar-685766":158},{"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","linked-lists-fundamentals-core-concepts-and-c-implementation-notes","Linked Lists - Fundamentals - Core Concepts and C++ Implementation Notes","","Linked list fundamentals explain how an ordered sequence of items is connected via links, how the structure size changes with insertions and deletions, and why dynamic memory allocation is commonly used. The notes show how to declare a Node using C++ structs, store item data and next-node pointers, and access list elements through head and tail pointers. It also covers using NULL end markers, handling empty lists safely, selecting members with . and -> operators, avoiding pointer bugs, and computing length by traversing nodes until the end.",{"@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/linked-lists-fundamentals-core-concepts-and-c-implementation-notes/685766/",{"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/linked-lists-fundamentals-core-concepts-and-c-implementation-notes/685766.png","ImageObject",300,407,{"name":92,"@type":93},"Margaret","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-30","2026-11-07",true,{"@type":102,"interactionType":103,"userInteractionCount":29},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"What defines a linked list in these notes?","Question",{"text":112,"@type":113},"A linked list is a sequence of items arranged one after another, where each item is connected to the next item through a link.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How are the head_ptr and tail_ptr used?",{"text":117,"@type":113},"The list is accessed through pointers to nodes. head_ptr and tail_ptr represent entry points to the list, and when the list is empty both pointers are set to NULL.",{"name":119,"@type":110,"acceptedAnswer":120},"How do you compute the length of a linked list?",{"text":121,"@type":113},"Initialize an answer counter to 0 and traverse from head_ptr using cursor=cursor->link until cursor becomes NULL, incrementing the counter each step, then return the result.","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},685766,1794017949,{"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":29,"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":81,"preview_urls":145},137451207643,"https://ap-avatar.wpscdn.com/davatar_3d24733baf745e90a7e4bdd5f77d97b2","Linked Lists  \nKruse and Ryba Textbook 4.1 and Chapter 6  \nLinked Lists  \n• Linked list of items is arranged in order  \n• Size of linked list changes as items are inserted or removed  \n• Dynamic memory allocation is often used in linked list implementation  \n• Ten fundamental functions are used to manipulate linked lists (see textbook) .  \n\n| Fundamentals\u003Cbr>• A linked list is a sequence of items arranged one after another.\u003Cbr>• Each item in list is connected to the next item via a link |\n| --- |\n| 12.1\u003Cbr>\u003Cbr>\u003Cbr>14.6 14.6 end marker \u003Cbr>\u003Cbr>|\n| • Each item is placed together with the link to the next item, resulting in a simple component called anode. |\n\nDeclaring a Class for Node  \nstruct Node {  \ntypedef double Item;  \nItem data; // data stored in node  \nNode *link; // pointer to next node} ;  \nA struct is a special kind of class where all members are public. In this case there are two public member variables: data, link.  \nWhenever a program needs to refer to the item type, we can use the expression Node::Item.  \nHead Pointers, Tail Pointers  \nUsually, programs do not actually declare node variables. Instead, the list is accessed through one or more pointers to nodes.  \nhead_ptr tail_ptr  \n| 12.1 |  |\n| --- | --- |\n\n| 14.6 |  |  | 14.6 | end marker |\n| --- | --- | --- | --- | --- |\n|  |  | |  |  |\n\nStruct Node  \n{  \ntypedef double Item;  \nItem data;  \nNode *link;  \n};  \nNode *head_ptr;  \nNode *tail_ptr;  \nhead_ptr tail_ptr  \n| 12.1 |  |\n| --- | --- |\n\n| 14.6 |  |  | 14.6 | end marker |\n| --- | --- | --- | --- | --- |\n|  |  | |  |  |\n\nNull Pointer  \n• The final node in the linked list does not point to a next node.  \n• If link does not point to a node, its value is set to NULL.  \n• NULL is a special C++ constant, from the standard library facility \u003Cstdlib.h>  \n• NULL pointer is often written 0 (zero) .  \nUse ofNULL pointer in last node of linked list:  \nhead_ptr tail_ptr  \n| 12.1 |  | | 14.6 |  | | 14.6 | NULL |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n\n| Empty List\u003Cbr>• When the list is empty, both the head_ptr and tail_ptrare NULL.\u003Cbr>• When creating a new linked list, it starts out empty (both tail and head pointers NULL) . |  |  |\n| --- | --- | --- |\n| Node *head_ptr, *tail_ptr; head_ptr = NULL; tail_ptr = NULL; | head_ptr\u003Cbr>\u003Cbr>Null | tail_ptr\u003Cbr>\u003Cbr>Null |\n| • Any linked list functions you write should handle the case of empty list (head and tail pointers NULL) . |  |  |\n\nMember Selection Operator Suppose a program has built a linked list:  \nhead_ptr tail_ptr  \n| 12.1 |  | | 14.6 |  | | 14.6 | NULL |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n\nhead_ptr is a pointer to a node. How can we get/set the value of the Item inside the node?  \nMember Selection Operator  \nOne possible syntax:  \n( *head_ptr) .data = 4.5 ; cout \u003C\u003C ( *head_ptr) .data;  \nThe expression (*head_ptr) .data means the data member of the node pointed to by head_ptr.  \nMember Selection Operator  \nPreferred syntax: head_ptr->data = 4.5 ;  \ncout \u003C\u003C head_ptr->data;  \nThe symbol “->” is considered a single operator. Reminds you of an arrow pointing to the member.  \nThe expression head_ptr->data means the data member of the node pointed to by head_ptr.  \nTwo Common Pointer Bugs  \n• Attempting to dereference a pointer via *p or p-> when p=NULL.  \n• Attempting to dereference a pointer via *p or p-> when p is not properly initialized.  \n• NOTE: this error does not cause a syntax error, but instead causes errors:  \n– Bus Error  \n– Segmentation violation  \n– Address protection violation  \nComputing the Length of a Linked List  \nsize_t list_length(Node * head_ptr){  \nNode *cursor;  \nsize_t answer=0 ;  \nfor(cursor=head_ptr; cursor != NULL; cursor=cursor->link)  \nanswer++;  \nreturn answer;}  \nComputing the Length of a  \nLinked List cursor=head_ptr;  \nhead_ptr  \n| 12.1 |  | | 14.6 |  | | 14.6 | NULL |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n\nComputing the Length of a  \nLinked List cursor=cursor->link;  \nhead_ptr  \n| 12.1 |  | | 14.6 |  | | 1","cbCaiioO5LGWjCiW","https://ap.wps.com/l/cbCaiioO5LGWjCiW","pdf",332226,26,"English","# Linked Lists\n## Core ideas of linked lists\n## Node declaration and pointers\n## Null pointers and empty lists\n## Member selection operator (., ->)\n## Common pointer bugs\n## Computing list length and traversal","[{\"question\":\"What defines a linked list in these notes?\",\"answer\":\"A linked list is a sequence of items arranged one after another, where each item is connected to the next item through a link.\"},{\"question\":\"How are the head_ptr and tail_ptr used?\",\"answer\":\"The list is accessed through pointers to nodes. head_ptr and tail_ptr represent entry points to the list, and when the list is empty both pointers are set to NULL.\"},{\"question\":\"How do you compute the length of a linked list?\",\"answer\":\"Initialize an answer counter to 0 and traverse from head_ptr using cursor=cursor-\\u003elink until cursor becomes NULL, incrementing the counter each step, then return the result.\"}]","Linked Lists - Fundamentals - Core Concepts and C++ Implementation Notes | PDF",66,[146,150,154],{"page_no":8,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/5136b99665e432060766f8094c8801e9.webp",983,1272,{"page_no":14,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/091c2cba2c53a610c821c9f605c8309c.webp",982,1270,{"page_no":81,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/97cd1ece61a0c098b858f8e3b472aac8.webp",981,1269,{"list":159,"token":66},[160,166,172,178,184,190,196,202,208,214],{"doc_id":161,"doc_title":162,"file_type":137,"home_preview_img_url":163,"slug":164,"view_count":24,"category_name":30,"create_tm":165},685667,"Implementing Singly Linked List in C++ - struct and pointers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000175839/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111279&Signature=bpzP%2F99w8Mdn89587zil8pyLAGM%3D","implementing-singly-linked-list-in-c-struct-and-pointers",1794016535,{"doc_id":167,"doc_title":168,"file_type":137,"home_preview_img_url":169,"slug":170,"view_count":81,"category_name":30,"create_tm":171},732873,"Singly Linked Lists in C - Introduction and Traversal Example","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031413508/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111279&Signature=TdQi5Gp1KO1mPRPIhSX1%2FiGI1kM%3D","singly-linked-lists-in-c-introduction-and-traversal-example",1795382670,{"doc_id":173,"doc_title":174,"file_type":137,"home_preview_img_url":175,"slug":176,"view_count":24,"category_name":30,"create_tm":177},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=1796111279&Signature=VfdLeEvMmcdgEhyIZnug0Ulw8sk%3D","chapter-4-linked-lists-41-singly-linked-lists-or-chains",1794017203,{"doc_id":179,"doc_title":180,"file_type":137,"home_preview_img_url":181,"slug":182,"view_count":81,"category_name":30,"create_tm":183},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=1796111279&Signature=g0pHOOIRA%2FfCFGdNwn0wgMMUupU%3D","unit11-linked-lists",1795382671,{"doc_id":185,"doc_title":186,"file_type":137,"home_preview_img_url":187,"slug":188,"view_count":24,"category_name":30,"create_tm":189},685726,"L6b - Linked List Variations - Lecture 6b","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000185855/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111279&Signature=0OP8tmzMFAi8xVBXDGMRpnNutLo%3D","l6b-linked-list-variations-lecture-6b",1794017196,{"doc_id":191,"doc_title":192,"file_type":137,"home_preview_img_url":193,"slug":194,"view_count":24,"category_name":30,"create_tm":195},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=1796111279&Signature=gv7RnjQA3vGAdwb%2FFWzq3dSTmcg%3D","linked-lists-introduction-properties-advantages-disadvantages-and-types",1794016969,{"doc_id":197,"doc_title":198,"file_type":137,"home_preview_img_url":199,"slug":200,"view_count":24,"category_name":30,"create_tm":201},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=1796111279&Signature=232W9CUUJoULHftIdvfUEYJpohU%3D","rohini-college-of-engineering-technology-linked-list-implementation-singly-linked-lists-core-algorithms-for-traversal-counting-searching-and-insertion",1794017223,{"doc_id":203,"doc_title":204,"file_type":137,"home_preview_img_url":205,"slug":206,"view_count":19,"category_name":30,"create_tm":207},685767,"Implementation of Linked List - Lecture 7 - In C++","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000198089/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111279&Signature=Q%2B1lQr8t9gHOKCbfb0EScmw5Wag%3D","implementation-of-linked-list-lecture-7-in-c",1794017950,{"doc_id":209,"doc_title":210,"file_type":137,"home_preview_img_url":211,"slug":212,"view_count":34,"category_name":30,"create_tm":213},685731,"Lecture Five - Linked List Structure","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999689386/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111279&Signature=NUPXWk%2BsaCHf8rPmqb3FrsunesQ%3D","lecture-five-linked-list-structure",1794017204,{"doc_id":215,"doc_title":216,"file_type":137,"home_preview_img_url":217,"slug":218,"view_count":81,"category_name":30,"create_tm":219},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=1796111279&Signature=8BTcENorexSvJfasZqk1rmRRrQk%3D","chapter-15-linked-data-structures-java-linked-lists-key-concepts",1795006731]