[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-685767-105":59,"doc-detail-685767-en":130,"doc-similar-685767":153},{"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","implementation-of-linked-list-lecture-7-in-c","Implementation of Linked List - Lecture 7 - In C++","","Lecture material on implementing a singly linked list in C++. It explains how to define a Node structure with data and next pointer, how to maintain a head pointer, and how to initialize an empty list. It presents algorithms for inserting nodes at the beginning, at the end, and at a given position, and for deleting nodes from the beginning, end, and a specific position. It also includes a C++ program demonstrating the operations and a display algorithm to traverse and print elements.",{"@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/implementation-of-linked-list-lecture-7-in-c/685767/",{"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/implementation-of-linked-list-lecture-7-in-c/685767.png","ImageObject",300,407,{"name":92,"@type":93},"Rhys","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-11","2026-11-07",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},"What is the Node structure used for in a singly linked list implementation?","Question",{"text":112,"@type":113},"A Node holds two members: data to store the value and a next pointer to reference the next node in the sequence.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How do you insert a new node at the end of a linked list?",{"text":117,"@type":113},"If the list is empty, set head to the new node; otherwise traverse to the last node and update its next pointer to the new node.",{"name":119,"@type":110,"acceptedAnswer":120},"What steps are used to delete a node at a given position?",{"text":121,"@type":113},"Validate the position, locate the node at position-1, store the target node in a temporary pointer, redirect the current node’s next to the target’s next, set the temp pointer’s next to NULL, and delete the target node.","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},685767,1794017950,{"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":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":41,"preview_page_count":14,"preview_urls":144},687207024643,"https://ap-avatar.wpscdn.com/davatar_3d24733baf745e90a7e4bdd5f77d97b2","|  |  | |  |\n| --- | --- | --- | --- |\n|  | \u003Cbr>قــســــــــــم المــــــــــــــــــــــــــن الــــــــــــــــــــــــــــــــــــسيبرانــــــــــــــــــــــــــــــــــــي\u003Cbr>Department of Cyber Security\u003Cbr>Subject: Data Structure\u003Cbr>Class: Second\u003Cbr>Lecturer: Asst. Prof. Dr. Ali Kadhum Al-Quraby\u003Cbr>Lecture: 7\u003Cbr>Implementation of Linked List |  |  |\n| |  |  |  |\n|  |  |  |  |\n\nImplementation of Linked List in C++  \nTo implement a linked list in C++ we can follow the below approach:  \nApproach:  \n• Define a structure Node having two members data and a next pointer. The data will store the value of the node and the next pointer will store the address of the next node in the sequence. For doubly linked list you will have to add an addition pointer prev that will store the address of the prev node in the sequence.  \n• Define a class LinkedList consisting of all the member functions for the LinkedList and a head pointer that will store the reference of a particular linked list.  \n• Initialize the head to NULL as the linked list is empty initially.  \n• Implement basic functions like insertAtBeginning, insertAtEnd, deleteFromBeginning, deleteFromEnd that will manipulate the elements of the linked list.  \nRepresentation of a Node in the Linked List  \nEach node of the linked list will be represented as a structure having two members data and next where:  \n• Data: Represents the value stored in the node.  \n• Next Pointer: Stores the reference to the next node in the  \nsequence.  \nstruct Node { int data; Node* next;  \n};  \nNote: Add another data member Node * prev in the structure for doubly linked lists.  \nAlgorithm for insertAtBeginning Implementation  \n1. Create a new Node  \n2. Point the new Node's next pointer to the current head.  \n3. Update the head of the linked list as the new node.  \nInserting a node at the first of the linked list  \nAlgorithm for insertAtEnd Implementation  \n1. Create a new Node  \n2. If the linked list is empty, update the head as the new node.  \n3. Otherwise traverse till the last node of the linked list.  \n4. Update the next pointer of the last node from NULL to new node.  \nInserting a node at the end of the linked list  \nAlgorithm for insertAtPosition Implementation  \n1. Check if the provided position by the user is a valid poistion.  \n2. Create a new node.  \n3. Find the node at position-1.  \n4. Update the next pointer of the new node to the next pointer of the current node.  \n5. Update the next pointer of the current node to new node.  \nInserting a node after the second position in the linked list  \nAlgorithm for deleteFromBeginning Implementation  \n1. Check whether the Head of the linked list is not NULL. If Head is equal to NULL return as the linked list is empty, there is no node present for deletion.  \n2. Store the head of the linked list in a temp pointer.  \n3. Update the head of the linked list to next node.  \n4. Delete the temporary node stored in the temp pointer.  \nDeleting the first node of the linked list  \nAlgorithm for deleteFromEnd Implementation  \n1. Verify whether the linked is empty or not before deletion.  \n2. If the linked list has only one node, delete head and set head to NULL.  \n3. Traverse till the second last node of the linked list.  \n4. Store the last node of the linked list in a temp pointer.  \n5. Pointer the next pointer of the second last node to NULL.  \n6. Delete the node represented by the temp pointer.  \nDeleting the last node of the linked list  \nAlgorithm for deleteFromPosition Implementation  \n1. Check if the provided postion by the users is a valid position in the linked list or not.  \n2. Find the node at position-1.  \n3. Save node to be deleted in a temp pointer.  \n4. Set the next pointer of the current node to the next pointer of the node to be deleted.  \n5. Set the next pointer of temp to NULL.  \n6. Delete the node represented by temp pointer.  \nDeleting the node present at the second position in the linked list  \nAlgorithm for Display Implementation  \n1. Check i","cbCaimH7lPI7zcbb","https://ap.wps.com/l/cbCaimH7lPI7zcbb","pdf",421351,12,"English","# Implementation of Linked List in C++\n## Data structure (Node) representation\n## Algorithms: insertion\n## Algorithms: deletion\n## Algorithm: display\n## C++ program example","[{\"question\":\"What is the Node structure used for in a singly linked list implementation?\",\"answer\":\"A Node holds two members: data to store the value and a next pointer to reference the next node in the sequence.\"},{\"question\":\"How do you insert a new node at the end of a linked list?\",\"answer\":\"If the list is empty, set head to the new node; otherwise traverse to the last node and update its next pointer to the new node.\"},{\"question\":\"What steps are used to delete a node at a given position?\",\"answer\":\"Validate the position, locate the node at position-1, store the target node in a temporary pointer, redirect the current node’s next to the target’s next, set the temp pointer’s next to NULL, and delete the target node.\"}]","Implementation of Linked List - Lecture 7 - In C++ | PDF",[145,149],{"page_no":8,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/28e4ecfe26e74e9f62a8aefc2caaaf03.webp",983,1272,{"page_no":14,"url":150,"width":151,"height":152},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/8aa70544a86fbb28fb99fdb3a23c67be.webp",982,1388,{"list":154,"token":66},[155,161,167,173,179,185,190,196,202,208],{"doc_id":156,"doc_title":157,"file_type":137,"home_preview_img_url":158,"slug":159,"view_count":19,"category_name":30,"create_tm":160},685736,"Singly Linked List in C - C Program - Linked List Operations Menu","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000186160/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111099&Signature=36GaNQcC60%2B33SLTyJMZEZC3o%2Bs%3D","singly-linked-list-in-c-c-program-linked-list-operations-menu",1794017213,{"doc_id":162,"doc_title":163,"file_type":137,"home_preview_img_url":164,"slug":165,"view_count":81,"category_name":30,"create_tm":166},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=1796111099&Signature=oXPj7ai7QCyQJrIrCiShX4HFMXg%3D","singly-linked-lists-in-c-introduction-and-traversal-example",1795382670,{"doc_id":168,"doc_title":169,"file_type":137,"home_preview_img_url":170,"slug":171,"view_count":34,"category_name":30,"create_tm":172},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=1796111099&Signature=CWYV7Ob7rUsK0XKkql3wrSc4imk%3D","lecture-five-linked-list-structure",1794017204,{"doc_id":174,"doc_title":175,"file_type":137,"home_preview_img_url":176,"slug":177,"view_count":24,"category_name":30,"create_tm":178},685762,"Linked List - Course 13004700 Part-2","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999691129/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111099&Signature=CN77Zb6Yz7jjgmwY3mKmwcLn2mQ%3D","linked-list-course-13004700-part-2",1794017631,{"doc_id":180,"doc_title":181,"file_type":137,"home_preview_img_url":182,"slug":183,"view_count":24,"category_name":30,"create_tm":184},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=1796111099&Signature=nShXkDv88%2BSyocvmUWDgUt%2F0hUA%3D","l6b-linked-list-variations-lecture-6b",1794017196,{"doc_id":186,"doc_title":187,"file_type":137,"home_preview_img_url":188,"slug":189,"view_count":19,"category_name":30,"create_tm":184},685727,"Circular Linked Lists - All Operations and Complexity Analysis","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000185859/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111099&Signature=W1FqIQTAq6PU11gaxIb%2FdGc6ijw%3D","circular-linked-lists-all-operations-and-complexity-analysis",{"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},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=1796111099&Signature=mgMGtR2Lkw9SyBBQm484rL%2FrrBY%3D","implementing-singly-linked-list-in-c-struct-and-pointers",1794016535,{"doc_id":197,"doc_title":198,"file_type":137,"home_preview_img_url":199,"slug":200,"view_count":29,"category_name":30,"create_tm":201},685766,"Linked Lists - Fundamentals - Core Concepts and C++ Implementation Notes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000198068/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111099&Signature=XelP2NNTs%2BaQ13bW72TDJzZg1QU%3D","linked-lists-fundamentals-core-concepts-and-c-implementation-notes",1794017949,{"doc_id":203,"doc_title":204,"file_type":137,"home_preview_img_url":205,"slug":206,"view_count":29,"category_name":30,"create_tm":207},685764,"Lists and Linked Lists - Part 1 - Introduction","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999691137/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111099&Signature=5WW4FcIVnOkXvkG5kCVZrNTYjIw%3D","lists-and-linked-lists-part-1-introduction",1794017635,{"doc_id":209,"doc_title":210,"file_type":137,"home_preview_img_url":211,"slug":212,"view_count":81,"category_name":30,"create_tm":213},732877,"Linked Data Structures - Linked Lists","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031413515/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111099&Signature=PLKF%2Fs%2BzFmVwnW9nzz1AAGgbBIc%3D","linked-data-structures-linked-lists",1795382677]