{"id":49735,"date":"2025-05-21T15:43:31","date_gmt":"2025-05-21T10:13:31","guid":{"rendered":"https:\/\/www.iquanta.in\/blog\/?p=49735"},"modified":"2025-05-21T16:44:14","modified_gmt":"2025-05-21T11:14:14","slug":"insertion-in-linked-list","status":"publish","type":"post","link":"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/","title":{"rendered":"Insertion in Linked List"},"content":{"rendered":"\n<p>We have covered our basics in linked list and also covered various applications. It is the time to understand how insertion is performed on a linked list whether we need to insert node in the beginning of a linked list, insertion of node at a given specified location, as well as the insertion at the end of the node.<\/p>\n\n\n\n<p>In this blog we will be covering entire insertion operations of linked list and some related interview questions that might help you to crack te software development roles in the job market. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img fetchpriority=\"high\" decoding=\"async\" width=\"875\" height=\"142\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-127.png\" alt=\"insertion in linked list\" class=\"wp-image-49733\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-127.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-127-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-127-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-127-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-127-696x113.png 696w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div>\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_77 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#What_is_a_linked_list_data_structure\" >What is a linked list data structure?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#Insertion_in_linked_list_from_the_beginning\" >Insertion in linked list from the beginning<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#C_Implementation\" >C Implementation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#C_Implementation-2\" >C++ Implementation<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#Insertion_in_linked_list_at_a_specified_location\" >Insertion in linked list at a specified location<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#C_Implementation-3\" >C Implementation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#C_Implementation-4\" >C++ Implementation<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#Insertion_in_linked_list_at_the_end\" >Insertion in linked list at the end<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#C_Implementation-5\" >C Implementation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#C_Implementation-6\" >C++ Implementation<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#FAQs\" >FAQs<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#What_is_a_linked_list\" >What is a linked list?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#What_is_insertion_in_a_linked_list\" >What is insertion in a linked list?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#How_do_you_insert_at_the_beginning\" >How do you insert at the beginning?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#How_do_you_insert_at_the_end\" >How do you insert at the end?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#What_happens_if_we_insert_at_position_1\" >What happens if we insert at position 1?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-what-is-a-linked-list-data-structure\"><span class=\"ez-toc-section\" id=\"What_is_a_linked_list_data_structure\"><\/span><strong>What is a linked list data structure? <\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Linked List data structure is a linear data structure in which data is stored in the node which is of struct type and the next node contains the address of the next node in the sequence of a linked list. <\/p>\n\n\n\n<p>There are different types of linked list which includes singly linked list, doubly linked lists as well as circular linked list data structure. The time complexity differs upon the operations performed on it. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-insertion-in-linked-list-from-the-beginning\"><span class=\"ez-toc-section\" id=\"Insertion_in_linked_list_from_the_beginning\"><\/span><strong>Insertion in linked list from the beginning<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To insert a node at the beginning of a linked list we first create a new node with the value we want to add. Then we make this new node point to the current first node of the list. After that we update the head of the list to this new node. Now this new node becomes the first element of the list. This is a quick and simple way to add elements at the front of a linked list.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-c-implementation\"><span class=\"ez-toc-section\" id=\"C_Implementation\"><\/span><strong>C Implementation<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\nstruct Node {\n    int data;\n    struct Node* next;\n};\n\nvoid insertAtBeginning(struct Node** headRef, int newData) {\n    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));\n    newNode-&gt;data = newData;\n    newNode-&gt;next = *headRef;\n    *headRef = newNode;\n}\n\nvoid printList(struct Node* head) {\n    struct Node* temp = head;\n    while (temp != NULL) {\n        printf(\"%d -&gt; \", temp-&gt;data);\n        temp = temp-&gt;next;\n    }\n    printf(\"NULL\\n\");\n}\n\nint main() {\n    struct Node* head = NULL;\n    insertAtBeginning(&amp;head, 30);\n    insertAtBeginning(&amp;head, 20);\n    insertAtBeginning(&amp;head, 10);\n    printList(head);\n    return 0;\n}\n\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-c-implementation-0\"><span class=\"ez-toc-section\" id=\"C_Implementation-2\"><\/span><strong>C++ Implementation<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream&gt;\nusing namespace std;\n\nstruct Node {\n    int data;\n    Node* next;\n\n    Node(int value) {\n        data = value;\n        next = nullptr;\n    }\n};\n\nvoid insertAtBeginning(Node*&amp; head, int newData) {\n    Node* newNode = new Node(newData);\n    newNode-&gt;next = head;\n    head = newNode;\n}\n\nvoid printList(Node* head) {\n    Node* temp = head;\n    while (temp != nullptr) {\n        cout &lt;&lt; temp-&gt;data &lt;&lt; \" -&gt; \";\n        temp = temp-&gt;next;\n    }\n    cout &lt;&lt; \"NULL\" &lt;&lt; endl;\n}\n\nint main() {\n    Node* head = nullptr;\n    insertAtBeginning(head, 100);\n    insertAtBeginning(head, 50);\n    insertAtBeginning(head, 25);\n    printList(head);\n    return 0;\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-insertion-in-linked-list-at-a-specified-location\"><span class=\"ez-toc-section\" id=\"Insertion_in_linked_list_at_a_specified_location\"><\/span><strong>Insertion in linked list at a specified location<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To insert a node at a specific position in a linked list we first create a new node with the value we want to add. Then we move through the list to find the node just before the desired position. Once we are at the right spot, we make the new node point to the next node and then we update the previous node to point to the new node. This way the new node is placed exactly where we want in the list without breaking the chain.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-c-implementation-1\"><span class=\"ez-toc-section\" id=\"C_Implementation-3\"><\/span><strong>C Implementation<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\nstruct Node {\n    int data;\n    struct Node* next;\n};\n\nvoid insertAtPosition(struct Node** headRef, int data, int position) {\n    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));\n    newNode-&gt;data = data;\n    newNode-&gt;next = NULL;\n\n    if (position == 1) {\n        newNode-&gt;next = *headRef;\n        *headRef = newNode;\n        return;\n    }\n\n    struct Node* temp = *headRef;\n    for (int i = 1; i &lt; position - 1 &amp;&amp; temp != NULL; i++) {\n        temp = temp-&gt;next;\n    }\n\n    if (temp == NULL) return;\n\n    newNode-&gt;next = temp-&gt;next;\n    temp-&gt;next = newNode;\n}\n\nvoid printList(struct Node* head) {\n    struct Node* temp = head;\n    while (temp != NULL) {\n        printf(\"%d -&gt; \", temp-&gt;data);\n        temp = temp-&gt;next;\n    }\n    printf(\"NULL\\n\");\n}\n\nint main() {\n    struct Node* head = NULL;\n    insertAtPosition(&amp;head, 10, 1);\n    insertAtPosition(&amp;head, 20, 2);\n    insertAtPosition(&amp;head, 15, 2);\n    insertAtPosition(&amp;head, 5, 1);\n    printList(head);\n    return 0;\n}\n<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img decoding=\"async\" width=\"875\" height=\"142\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-128.png\" alt=\"\" class=\"wp-image-49741\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-128.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-128-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-128-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-128-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-128-696x113.png 696w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-c-implementation-2\"><span class=\"ez-toc-section\" id=\"C_Implementation-4\"><\/span><strong>C++ Implementation<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream&gt;\nusing namespace std;\n\nstruct Node {\n    int data;\n    Node* next;\n\n    Node(int value) {\n        data = value;\n        next = nullptr;\n    }\n};\n\nvoid insertAtPosition(Node*&amp; head, int data, int position) {\n    Node* newNode = new Node(data);\n\n    if (position == 1) {\n        newNode-&gt;next = head;\n        head = newNode;\n        return;\n    }\n\n    Node* temp = head;\n    for (int i = 1; i &lt; position - 1 &amp;&amp; temp != nullptr; i++) {\n        temp = temp-&gt;next;\n    }\n\n    if (temp == nullptr) return;\n\n    newNode-&gt;next = temp-&gt;next;\n    temp-&gt;next = newNode;\n}\n\nvoid printList(Node* head) {\n    Node* temp = head;\n    while (temp != nullptr) {\n        cout &lt;&lt; temp-&gt;data &lt;&lt; \" -&gt; \";\n        temp = temp-&gt;next;\n    }\n    cout &lt;&lt; \"NULL\" &lt;&lt; endl;\n}\n\nint main() {\n    Node* head = nullptr;\n    insertAtPosition(head, 100, 1);\n    insertAtPosition(head, 200, 2);\n    insertAtPosition(head, 150, 2);\n    insertAtPosition(head, 50, 1);\n    printList(head);\n    return 0;\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-insertion-in-linked-list-at-the-end\"><span class=\"ez-toc-section\" id=\"Insertion_in_linked_list_at_the_end\"><\/span><strong>Insertion in linked list at the end<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To insert a node at the end of a linked list we first create a new node with the value we want to add. If the list is empty, this new node becomes the first node. Otherwise we start from the head and move through the list until we reach the last node. <\/p>\n\n\n\n<p>Then we have to make the last node point to our new node. This places the new node at the very end of the list, extending the chain.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-c-implementation-3\"><span class=\"ez-toc-section\" id=\"C_Implementation-5\"><\/span><strong>C Implementation<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\nstruct Node {\n    int data;\n    struct Node* next;\n};\n\nvoid insertAtEnd(struct Node** headRef, int data) {\n    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));\n    newNode-&gt;data = data;\n    newNode-&gt;next = NULL;\n\n    if (*headRef == NULL) {\n        *headRef = newNode;\n        return;\n    }\n\n    struct Node* temp = *headRef;\n    while (temp-&gt;next != NULL) {\n        temp = temp-&gt;next;\n    }\n    temp-&gt;next = newNode;\n}\n\nvoid printList(struct Node* head) {\n    struct Node* temp = head;\n    while (temp != NULL) {\n        printf(\"%d -&gt; \", temp-&gt;data);\n        temp = temp-&gt;next;\n    }\n    printf(\"NULL\\n\");\n}\n\nint main() {\n    struct Node* head = NULL;\n    insertAtEnd(&amp;head, 10);\n    insertAtEnd(&amp;head, 20);\n    insertAtEnd(&amp;head, 30);\n    printList(head);\n    return 0;\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-c-implementation-4\"><span class=\"ez-toc-section\" id=\"C_Implementation-6\"><\/span><strong>C++ Implementation<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream&gt;\nusing namespace std;\n\nstruct Node {\n    int data;\n    Node* next;\n\n    Node(int value) {\n        data = value;\n        next = nullptr;\n    }\n};\n\nvoid insertAtEnd(Node*&amp; head, int data) {\n    Node* newNode = new Node(data);\n\n    if (head == nullptr) {\n        head = newNode;\n        return;\n    }\n\n    Node* temp = head;\n    while (temp-&gt;next != nullptr) {\n        temp = temp-&gt;next;\n    }\n    temp-&gt;next = newNode;\n}\n\nvoid printList(Node* head) {\n    Node* temp = head;\n    while (temp != nullptr) {\n        cout &lt;&lt; temp-&gt;data &lt;&lt; \" -&gt; \";\n        temp = temp-&gt;next;\n    }\n    cout &lt;&lt; \"NULL\" &lt;&lt; endl;\n}\n\nint main() {\n    Node* head = nullptr;\n    insertAtEnd(head, 100);\n    insertAtEnd(head, 200);\n    insertAtEnd(head, 300);\n    printList(head);\n    return 0;\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-faqs\"><span class=\"ez-toc-section\" id=\"FAQs\"><\/span><strong>FAQs <\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-is-a-linked-list\"><span class=\"ez-toc-section\" id=\"What_is_a_linked_list\"><\/span><strong>What is a linked list?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>A linked list is a data structure where each element called a node which points to the next one in the list.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-is-insertion-in-a-linked-list\"><span class=\"ez-toc-section\" id=\"What_is_insertion_in_a_linked_list\"><\/span><strong>What is insertion in a linked list?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Insertion means adding a new node to the list at the beginning, middle, or end.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-do-you-insert-at-the-beginning\"><span class=\"ez-toc-section\" id=\"How_do_you_insert_at_the_beginning\"><\/span><strong>How do you insert at the beginning?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Create a new node, point it to the current head and update head to this new node.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-do-you-insert-at-the-end\"><span class=\"ez-toc-section\" id=\"How_do_you_insert_at_the_end\"><\/span><strong>How do you insert at the end?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Create a new node then go to the last node and point its next to the new node.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-happens-if-we-insert-at-position-1\"><span class=\"ez-toc-section\" id=\"What_happens_if_we_insert_at_position_1\"><\/span><strong>What happens if we insert at position 1?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>It is the same as inserting at the beginning where the new node becomes the head.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img decoding=\"async\" width=\"875\" height=\"142\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-129.png\" alt=\"insertion in linked list\" class=\"wp-image-49742\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-129.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-129-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-129-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-129-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-129-696x113.png 696w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have covered our basics in linked list and also covered various applications. It is the time to understand how insertion is performed on a linked list whether we need to insert node in the beginning of a linked list, insertion of node at a given specified location, as well as the insertion at the [&hellip;]<\/p>\n","protected":false},"author":560,"featured_media":49739,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1075,1073],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.4 (Yoast SEO v21.9.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Insertion in Linked List - iQuanta<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Insertion in Linked List\" \/>\n<meta property=\"og:description\" content=\"We have covered our basics in linked list and also covered various applications. It is the time to understand how insertion is performed on a linked list whether we need to insert node in the beginning of a linked list, insertion of node at a given specified location, as well as the insertion at the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/\" \/>\n<meta property=\"og:site_name\" content=\"iQuanta\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/iquanta.in\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-21T10:13:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-21T11:14:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/WhatsApp-Image-2025-05-21-at-3.00.10-PM.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"900\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Nidhi Goswami\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nidhi Goswami\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/\"},\"author\":{\"name\":\"Nidhi Goswami\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3\"},\"headline\":\"Insertion in Linked List\",\"datePublished\":\"2025-05-21T10:13:31+00:00\",\"dateModified\":\"2025-05-21T11:14:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/\"},\"wordCount\":580,\"publisher\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\"},\"articleSection\":[\"DSA and Competitive Programming\",\"iSkills\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/\",\"url\":\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/\",\"name\":\"Insertion in Linked List - iQuanta\",\"isPartOf\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#website\"},\"datePublished\":\"2025-05-21T10:13:31+00:00\",\"dateModified\":\"2025-05-21T11:14:14+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.iquanta.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Insertion in Linked List\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#website\",\"url\":\"https:\/\/www.iquanta.in\/blog\/\",\"name\":\"iQuanta | Cat Preparation Online\",\"description\":\"Building Learning Networks\",\"publisher\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.iquanta.in\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\",\"name\":\"IQuanta\",\"url\":\"https:\/\/www.iquanta.in\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png\",\"contentUrl\":\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png\",\"width\":525,\"height\":200,\"caption\":\"IQuanta\"},\"image\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/facebook.com\/iquanta.in\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3\",\"name\":\"Nidhi Goswami\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g\",\"caption\":\"Nidhi Goswami\"},\"url\":\"https:\/\/www.iquanta.in\/blog\/author\/nidhigoswami\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Insertion in Linked List - iQuanta","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/","og_locale":"en_US","og_type":"article","og_title":"Insertion in Linked List","og_description":"We have covered our basics in linked list and also covered various applications. It is the time to understand how insertion is performed on a linked list whether we need to insert node in the beginning of a linked list, insertion of node at a given specified location, as well as the insertion at the [&hellip;]","og_url":"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/","og_site_name":"iQuanta","article_publisher":"https:\/\/facebook.com\/iquanta.in","article_published_time":"2025-05-21T10:13:31+00:00","article_modified_time":"2025-05-21T11:14:14+00:00","og_image":[{"width":1600,"height":900,"url":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/WhatsApp-Image-2025-05-21-at-3.00.10-PM.jpeg","type":"image\/jpeg"}],"author":"Nidhi Goswami","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Nidhi Goswami","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#article","isPartOf":{"@id":"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/"},"author":{"name":"Nidhi Goswami","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3"},"headline":"Insertion in Linked List","datePublished":"2025-05-21T10:13:31+00:00","dateModified":"2025-05-21T11:14:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/"},"wordCount":580,"publisher":{"@id":"https:\/\/www.iquanta.in\/blog\/#organization"},"articleSection":["DSA and Competitive Programming","iSkills"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/","url":"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/","name":"Insertion in Linked List - iQuanta","isPartOf":{"@id":"https:\/\/www.iquanta.in\/blog\/#website"},"datePublished":"2025-05-21T10:13:31+00:00","dateModified":"2025-05-21T11:14:14+00:00","breadcrumb":{"@id":"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.iquanta.in\/blog\/insertion-in-linked-list\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.iquanta.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Insertion in Linked List"}]},{"@type":"WebSite","@id":"https:\/\/www.iquanta.in\/blog\/#website","url":"https:\/\/www.iquanta.in\/blog\/","name":"iQuanta | Cat Preparation Online","description":"Building Learning Networks","publisher":{"@id":"https:\/\/www.iquanta.in\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.iquanta.in\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.iquanta.in\/blog\/#organization","name":"IQuanta","url":"https:\/\/www.iquanta.in\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png","contentUrl":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png","width":525,"height":200,"caption":"IQuanta"},"image":{"@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/iquanta.in"]},{"@type":"Person","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3","name":"Nidhi Goswami","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g","caption":"Nidhi Goswami"},"url":"https:\/\/www.iquanta.in\/blog\/author\/nidhigoswami\/"}]}},"_links":{"self":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/49735"}],"collection":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/users\/560"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/comments?post=49735"}],"version-history":[{"count":4,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/49735\/revisions"}],"predecessor-version":[{"id":49765,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/49735\/revisions\/49765"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/media\/49739"}],"wp:attachment":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/media?parent=49735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/categories?post=49735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/tags?post=49735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}