{"id":49698,"date":"2025-05-21T14:31:18","date_gmt":"2025-05-21T09:01:18","guid":{"rendered":"https:\/\/www.iquanta.in\/blog\/?p=49698"},"modified":"2025-05-21T14:31:21","modified_gmt":"2025-05-21T09:01:21","slug":"deletion-in-linked-list","status":"publish","type":"post","link":"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/","title":{"rendered":"Deletion in Linked List"},"content":{"rendered":"\n<p>Linked list is one of the fundamental concept in computer science and we have already covered <a href=\"https:\/\/www.iquanta.in\/blog\/linked-list-data-structure-its-operations-complexity\/\">linked list data structure<\/a> and now we are covering deletion in linked list. <\/p>\n\n\n\n<p>We are going to cover every possible way to delete a node in the linked list whether we need to delete a node in the beginning of a linked list, deletion of a node at the specified location (any random node) and the last node in a linked list.<\/p>\n\n\n\n<p>Let&#8217;s begin first with the deletion of linked list from the beginning or start. <\/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-119.png\" alt=\"deletion of linked list \" class=\"wp-image-49639\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-119.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-119-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-119-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-119-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-119-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\/deletion-in-linked-list\/#Deletion_in_linked_list_from_the_beginning\" >Deletion 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-2\" href=\"https:\/\/www.iquanta.in\/blog\/deletion-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-3\" href=\"https:\/\/www.iquanta.in\/blog\/deletion-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-4\" href=\"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/#Deletion_in_linked_list_from_a_specified_position\" >Deletion in linked list from a specified position<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.iquanta.in\/blog\/deletion-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-6\" href=\"https:\/\/www.iquanta.in\/blog\/deletion-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-7\" href=\"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/#Deletion_in_linked_list_from_the_end\" >Deletion in linked list from 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-8\" href=\"https:\/\/www.iquanta.in\/blog\/deletion-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-9\" href=\"https:\/\/www.iquanta.in\/blog\/deletion-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-10\" href=\"https:\/\/www.iquanta.in\/blog\/deletion-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-11\" href=\"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/#What_happen_if_we_try_to_delete_from_the_empty_linked_list\" >What happen if we try to delete from the empty linked list?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/#What_is_the_time_complexity_for_deletion_in_a_linked_list\" >What is the time complexity for deletion in a linked list?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-deletion-in-linked-list-from-the-beginning\"><span class=\"ez-toc-section\" id=\"Deletion_in_linked_list_from_the_beginning\"><\/span><strong>Deletion in linked list from the beginning<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Deletion in linked list from the beginning is a simple deletion operation. In a singly linked list, each node points to the next node in a linked list and the entire list start with the head node. <\/p>\n\n\n\n<p>To delete the first node, we need to simply move the head pointer to the next node in the list and deallocate the memory occupied by the first node node in a list. This operation is quiet efficient as it does not require traversing the linked list. It requires a pointer change and memory free operation.<\/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<p>This code helps you to implement the deletion of a linked list in c programming language. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n\r\nstruct Node {\r\n    int data;\r\n    struct Node* next;\r\n};\r\n\r\nvoid deleteFromBeginning(struct Node** head) {\r\n    if (*head == NULL) {\r\n        printf(\"List is empty.\\n\");\r\n        return;\r\n    }\r\n\r\n    struct Node* temp = *head;\r\n    *head = (*head)-&gt;next;\r\n    free(temp);\r\n}\r<\/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<p>Below is the implementation of deleting the first node from a linked list in C++ programming language. <\/p>\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\nvoid deleteFromBeginning(Node*&amp; head) {\n    if (head == nullptr) {\n        cout &lt;&lt; \"List is empty.\" &lt;&lt; endl;\n        return;\n    }\n\n    Node* temp = head;\n    head = head-&gt;next;\n    delete temp;\n}<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img decoding=\"async\" width=\"521\" height=\"191\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/Untitled-Diagram-4.jpg\" alt=\"deletion in linked list from beginning\" class=\"wp-image-49723\" style=\"width:773px;height:auto\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/Untitled-Diagram-4.jpg 521w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/Untitled-Diagram-4-300x110.jpg 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/Untitled-Diagram-4-150x55.jpg 150w\" sizes=\"(max-width: 521px) 100vw, 521px\" \/><\/figure><\/div>\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-125.png\" alt=\"\" class=\"wp-image-49728\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-696x113.png 696w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-deletion-in-linked-list-from-a-specified-position\"><span class=\"ez-toc-section\" id=\"Deletion_in_linked_list_from_a_specified_position\"><\/span><strong>Deletion in linked list from a specified position<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Deletion in linked list from a specified position requires careful traversal. Suppose you want to delete the node at the position pos(1-based index) as You will need to traverse the list up to the node just before the target position and then change its next pointer to skip the node that needs to be deleted. After adjusting the pointer you have to deallocate the memory for the removed node. Boundary checks are necessary to ensure the position is valid and the list is not empty.<\/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>void deleteFromPosition(struct Node** head, int position) {\r\n    if (*head == NULL || position &lt;= 0) {\r\n        printf(\"Invalid position or list is empty.\\n\");\r\n        return;\r\n    }\r\n\r\n    struct Node* temp = *head;\r\n\r\n    if (position == 1) {\r\n        *head = temp-&gt;next;\r\n        free(temp);\r\n        return;\r\n    }\r\n\r\n    for (int i = 1; temp != NULL &amp;&amp; i &lt; position - 1; i++) {\r\n        temp = temp-&gt;next;\r\n    }\r\n\r\n    if (temp == NULL || temp-&gt;next == NULL) {\r\n        printf(\"Position exceeds list length.\\n\");\r\n        return;\r\n    }\r\n\r\n    struct Node* nodeToDelete = temp-&gt;next;\r\n    temp-&gt;next = nodeToDelete-&gt;next;\r\n    free(nodeToDelete);\r\n}\r<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img loading=\"lazy\" decoding=\"async\" width=\"875\" height=\"142\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125.png\" alt=\"deletion of linked list\" class=\"wp-image-49728\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-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>void deleteFromPosition(Node*&amp; head, int position) {\n    if (head == nullptr || position &lt;= 0) {\n        cout &lt;&lt; \"Invalid position or list is empty.\" &lt;&lt; endl;\n        return;\n    }\n\n    if (position == 1) {\n        Node* temp = head;\n        head = head-&gt;next;\n        delete temp;\n        return;\n    }\n\n    Node* current = head;\n    for (int i = 1; current != nullptr &amp;&amp; i &lt; position - 1; i++) {\n        current = current-&gt;next;\n    }\n\n    if (current == nullptr || current-&gt;next == nullptr) {\n        cout &lt;&lt; \"Position exceeds list length.\" &lt;&lt; endl;\n        return;\n    }\n\n    Node* nodeToDelete = current-&gt;next;\n    current-&gt;next = nodeToDelete-&gt;next;\n    delete nodeToDelete;\n}\n\n<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"721\" height=\"191\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/Untitled-Diagram-5.jpg\" alt=\"deletion in linked list at the specified position\" class=\"wp-image-49727\" style=\"width:763px;height:auto\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/Untitled-Diagram-5.jpg 721w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/Untitled-Diagram-5-300x79.jpg 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/Untitled-Diagram-5-150x40.jpg 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/Untitled-Diagram-5-696x184.jpg 696w\" sizes=\"(max-width: 721px) 100vw, 721px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-deletion-in-linked-list-from-the-end\"><span class=\"ez-toc-section\" id=\"Deletion_in_linked_list_from_the_end\"><\/span><strong>Deletion in linked list from the end<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To delete the last node in a singly linked list, you must traverse the list until you reach the second-last node, then set its next pointer to NULL and free the last node. This operation has a linear time complexity as traversal is required. Special care must be taken when the list has only one node.<\/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>void deleteFromEnd(struct Node** head) {\r\n    if (*head == NULL) {\r\n        printf(\"List is empty.\\n\");\r\n        return;\r\n    }\r\n\r\n    if ((*head)-&gt;next == NULL) {\r\n        free(*head);\r\n        *head = NULL;\r\n        return;\r\n    }\r\n\r\n    struct Node* temp = *head;\r\n    while (temp-&gt;next-&gt;next != NULL) {\r\n        temp = temp-&gt;next;\r\n    }\r\n\r\n    free(temp-&gt;next);\r\n    temp-&gt;next = NULL;\r\n}\r<\/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>void deleteFromEnd(Node*&amp; head) {\r\n    if (head == nullptr) {\r\n        cout &lt;&lt; \"List is empty.\" &lt;&lt; endl;\r\n        return;\r\n    }\r\n\r\n    if (head-&gt;next == nullptr) {\r\n        delete head;\r\n        head = nullptr;\r\n        return;\r\n    }\r\n\r\n    Node* current = head;\r\n    while (current-&gt;next-&gt;next != nullptr) {\r\n        current = current-&gt;next;\r\n    }\r\n\r\n    delete current-&gt;next;\r\n    current-&gt;next = nullptr;\r\n}\r<\/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-happen-if-we-try-to-delete-from-the-empty-linked-list\"><span class=\"ez-toc-section\" id=\"What_happen_if_we_try_to_delete_from_the_empty_linked_list\"><\/span><strong>What happen if we try to delete from the empty linked list?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The program should check for this case and handle it gracefully by printing a message or returning early.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img loading=\"lazy\" decoding=\"async\" width=\"875\" height=\"142\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125.png\" alt=\"deletion of linked list\" class=\"wp-image-49728\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-125-696x113.png 696w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-is-the-time-complexity-for-deletion-in-a-linked-list\"><span class=\"ez-toc-section\" id=\"What_is_the_time_complexity_for_deletion_in_a_linked_list\"><\/span><strong>What is the time complexity for deletion in a linked list?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul>\n<li>Deletion from the beginning: O(1)<\/li>\n\n\n\n<li>Deletion from a given position or end: O(n) due to traversal<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-\"> <\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Linked list is one of the fundamental concept in computer science and we have already covered linked list data structure and now we are covering deletion in linked list. We are going to cover every possible way to delete a node in the linked list whether we need to delete a node in the beginning [&hellip;]<\/p>\n","protected":false},"author":560,"featured_media":49729,"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>Deletion in Linked List - iQuanta<\/title>\n<meta name=\"description\" content=\"Explore the deletion in linked list from the beginning, from the specified location (any random node) as well as at the deletion at the end..\" \/>\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\/deletion-in-linked-list\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deletion in Linked List\" \/>\n<meta property=\"og:description\" content=\"Explore the deletion in linked list from the beginning, from the specified location (any random node) as well as at the deletion at the end..\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.iquanta.in\/blog\/deletion-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-21T09:01:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-21T09:01:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/WhatsApp-Image-2025-05-21-at-2.08.32-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\/deletion-in-linked-list\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/\"},\"author\":{\"name\":\"Nidhi Goswami\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3\"},\"headline\":\"Deletion in Linked List\",\"datePublished\":\"2025-05-21T09:01:18+00:00\",\"dateModified\":\"2025-05-21T09:01:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/\"},\"wordCount\":457,\"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\/deletion-in-linked-list\/\",\"url\":\"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/\",\"name\":\"Deletion in Linked List - iQuanta\",\"isPartOf\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#website\"},\"datePublished\":\"2025-05-21T09:01:18+00:00\",\"dateModified\":\"2025-05-21T09:01:21+00:00\",\"description\":\"Explore the deletion in linked list from the beginning, from the specified location (any random node) as well as at the deletion at the end..\",\"breadcrumb\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.iquanta.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deletion 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":"Deletion in Linked List - iQuanta","description":"Explore the deletion in linked list from the beginning, from the specified location (any random node) as well as at the deletion at the end..","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\/deletion-in-linked-list\/","og_locale":"en_US","og_type":"article","og_title":"Deletion in Linked List","og_description":"Explore the deletion in linked list from the beginning, from the specified location (any random node) as well as at the deletion at the end..","og_url":"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/","og_site_name":"iQuanta","article_publisher":"https:\/\/facebook.com\/iquanta.in","article_published_time":"2025-05-21T09:01:18+00:00","article_modified_time":"2025-05-21T09:01:21+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-2.08.32-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\/deletion-in-linked-list\/#article","isPartOf":{"@id":"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/"},"author":{"name":"Nidhi Goswami","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3"},"headline":"Deletion in Linked List","datePublished":"2025-05-21T09:01:18+00:00","dateModified":"2025-05-21T09:01:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/"},"wordCount":457,"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\/deletion-in-linked-list\/","url":"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/","name":"Deletion in Linked List - iQuanta","isPartOf":{"@id":"https:\/\/www.iquanta.in\/blog\/#website"},"datePublished":"2025-05-21T09:01:18+00:00","dateModified":"2025-05-21T09:01:21+00:00","description":"Explore the deletion in linked list from the beginning, from the specified location (any random node) as well as at the deletion at the end..","breadcrumb":{"@id":"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.iquanta.in\/blog\/deletion-in-linked-list\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.iquanta.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Deletion 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\/49698"}],"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=49698"}],"version-history":[{"count":6,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/49698\/revisions"}],"predecessor-version":[{"id":49730,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/49698\/revisions\/49730"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/media\/49729"}],"wp:attachment":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/media?parent=49698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/categories?post=49698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/tags?post=49698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}