

{"id":94981,"date":"2021-05-24T09:00:04","date_gmt":"2021-05-24T03:30:04","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=94981"},"modified":"2021-05-14T18:31:11","modified_gmt":"2021-05-14T13:01:11","slug":"doubly-linked-list-in-data-structure","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/","title":{"rendered":"Doubly Linked List in Data Structure"},"content":{"rendered":"<p>We have already seen the singly linked list in our previous article. A doubly linked list is a complex version of a singly linked list. Unlike a singly linked list, a doubly-linked list has each node pointed to its next node as well as its previous node.<\/p>\n<p>Let us consider the same example as the previous article. Suppose you are inside a train. You can move from any coach to any coach because each coach has a two-way link to its next coach and to its previous coach.<\/p>\n<p>Similarly, in a doubly-linked list, each node is connected to its previous node and next node making the accessibility very easy in comparison to a singly linked list.<\/p>\n<p>In this article, we are going to learn about doubly-linked lists, types, and how to perform some often used operations on a doubly linked list.<\/p>\n<h3>Doubly linked list<\/h3>\n<p><span style=\"font-weight: 400;\">A doubly linked list is a complex version of a singly linked list where each node contains a pointer to its previous node as well as the next node. Each node in the doubly linked list has three parts, the first part points to the previous node, the middle part contains the data and the last part points to the next node.\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img01.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-95310\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img01.jpg\" alt=\"Doubly Linked List\" width=\"1200\" height=\"400\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img01-300x100.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img01-1024x341.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img01-150x50.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img01-768x256.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img01-720x240.jpg 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img01-520x173.jpg 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img01-320x107.jpg 320w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<h3>Memory representation of Doubly Linked List<\/h3>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<td><b>previous<\/b><\/td>\n<td><b>data<\/b><\/td>\n<td><b>next<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">NULL<\/span><\/td>\n<td><span style=\"font-weight: 400;\">DATA<\/span><\/td>\n<td><span style=\"font-weight: 400;\">4<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">2<\/span><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">3<\/span><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">4<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">FLAIR<\/span><\/td>\n<td><span style=\"font-weight: 400;\">6<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">5<\/span><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">6<\/span><\/td>\n<td><span style=\"font-weight: 400;\">4<\/span><\/td>\n<td><span style=\"font-weight: 400;\">DS<\/span><\/td>\n<td><span style=\"font-weight: 400;\">7<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">7<\/span><\/td>\n<td><span style=\"font-weight: 400;\">6<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Stack<\/span><\/td>\n<td><span style=\"font-weight: 400;\">NULL<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Operations on doubly linked list<\/h3>\n<ul>\n<li style=\"font-weight: 400;\"><b>Insert:<\/b><span style=\"font-weight: 400;\"> adding a new node to the existing doubly linked list.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Delete<\/b><span style=\"font-weight: 400;\">: removing a node from the existing doubly linked list.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Search:<\/b><span style=\"font-weight: 400;\"> finding a node containing the search data in the existing doubly linked list.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Display:<\/b><span style=\"font-weight: 400;\"> display the existing doubly linked list.<\/span><\/li>\n<\/ul>\n<h3>Creating node in Doubly Linked List<\/h3>\n<p><span style=\"font-weight: 400;\">C program to create a node in a doubly-linked list:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">struct node   \r\n{  \r\n    struct node *prev;  \/\/NULL for first node\r\n    int data;                 \/\/ data to store in node\r\n    struct node *next;   \/\/NULL for last node\r\n}<\/pre>\n<h3>Traversing a doubly linked list<\/h3>\n<p><span style=\"font-weight: 400;\">Visit each node from start to end one by one.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">void printList(struct Node* n)\r\n{\r\n    while (n != NULL) {\r\n        printf(\" %d \", n-&gt;data);\r\n        n = n-&gt;next;\r\n    }\r\n}<\/pre>\n<h3>Adding node in Doubly Linked List<\/h3>\n<h4>1. Adding node at the beginning in Doubly Linked List<\/h4>\n<p><span style=\"font-weight: 400;\">Point the next pointer of the new node to the first node and point the previous pointer of the current first node to the new node. Point previous of new node to NULL. The new node is now the first node of the linked list.<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img02.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-95311\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img02.jpg\" alt=\"Adding node at start in Doubly Linked List\" width=\"1200\" height=\"400\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img02.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img02-300x100.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img02-1024x341.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img02-150x50.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img02-768x256.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img02-720x240.jpg 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img02-520x173.jpg 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img02-320x107.jpg 320w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">void insertAtBegin(node *new) \r\n{\r\n     new-&gt;next = head;\r\n     head -&gt; previous = new;\r\n     head = new;\r\n }<\/pre>\n<h4>2. Adding node at the end in Doubly Linked List<\/h4>\n<p><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">To add the node in the last position, point the next pointer of the last node to the new node and point the previous pointer of the new node to the current last node. Point the next of the new node to null.<\/span><\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img03.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-95312\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img03.jpg\" alt=\"Adding node at end of Doubly Linked List\" width=\"1200\" height=\"400\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img03.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img03-300x100.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img03-1024x341.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img03-150x50.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img03-768x256.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img03-720x240.jpg 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img03-520x173.jpg 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img03-320x107.jpg 320w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Void AddAtEnd(node *new)\r\n{\r\n     while (last -&gt; next != NULL)\r\n          last = last -&gt; next;\r\n     last -&gt; next = new;\r\n     new -&gt; previous = last;\r\n     new -&gt; next = NULL;\r\n}<\/pre>\n<h4>3. Adding node at a specific position in Doubly Linked List<\/h4>\n<p><span style=\"font-weight: 400;\">If you want to add a node at the n<\/span><span style=\"font-weight: 400;\">th<\/span><span style=\"font-weight: 400;\"> position, point the next pointer of the new node to the (n+1)<\/span><span style=\"font-weight: 400;\">th<\/span><span style=\"font-weight: 400;\"> node and point the previous pointer of the new node to (n-1)<\/span><span style=\"font-weight: 400;\">th<\/span><span style=\"font-weight: 400;\"> node. After that, point the next of (n-1)<\/span><span style=\"font-weight: 400;\">th<\/span><span style=\"font-weight: 400;\"> node and previous of (n+1)<\/span><span style=\"font-weight: 400;\">th<\/span><span style=\"font-weight: 400;\"> node to the new node.\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img04.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-95313\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img04.jpg\" alt=\"Adding node in Doubly Linked List\" width=\"1200\" height=\"400\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img04.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img04-300x100.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img04-1024x341.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img04-150x50.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img04-768x256.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img04-720x240.jpg 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img04-520x173.jpg 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img04-320x107.jpg 320w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Void AddAtPosition(node *new, node *prev)\r\n{\r\n    new -&gt; next = prev-&gt; next;\r\n     new -&gt; previous = prev;\r\n    (previous -&gt; next) -&gt; previous = new;\r\n     prev -&gt; next= new;\r\n}<\/pre>\n<h3>Deleting node in Doubly Linked List<\/h3>\n<h4>1. Delete node at the beginning of Doubly Linked List<\/h4>\n<p><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Point the next pointer of the first node and the previous pointer of the second node to null.<\/span><\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img05.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-95314\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img05.jpg\" alt=\"Delet node at start of doubly linked list\" width=\"1200\" height=\"400\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img05.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img05-300x100.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img05-1024x341.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img05-150x50.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img05-768x256.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img05-720x240.jpg 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img05-520x173.jpg 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img05-320x107.jpg 320w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">void DeleteAtFirst()\r\n{\r\n     Node *temp  = *head;   \r\n     head = temp -&gt; next;\r\n     head -&gt; previous = NULL;\r\n     free(temp);  \r\n}<\/pre>\n<h4>2. Delete node at the end of Doubly Linked List<\/h4>\n<p><span style=\"font-weight: 400;\">Point next pointer of the second last node and previous pointer of the last node to null.<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img06.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-95315\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img06.jpg\" alt=\"Delete node at end of doubly linked list\" width=\"1200\" height=\"400\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img06.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img06-300x100.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img06-1024x341.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img06-150x50.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img06-768x256.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img06-720x240.jpg 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img06-520x173.jpg 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img06-320x107.jpg 320w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">void DeleteAtLast()\r\n{\r\n     Node *ptr, *ptr1;\r\n     ptr = head;\r\n     while (ptr -&gt; next != NULL)\r\n     {\r\n          ptr1 = ptr;\r\n          ptr = ptr -&gt; next;\r\n     }\r\n     ptr1 -&gt; next =NULL;\r\n     free ptr;   \r\n}<\/pre>\n<p><b>3. Delete node at any position in Doubly Linked List<\/b><\/p>\n<p><span style=\"font-weight: 400;\">If you want to delete the node at the n<\/span><span style=\"font-weight: 400;\">th<\/span><span style=\"font-weight: 400;\"> position, point the next of (n-1)<\/span><span style=\"font-weight: 400;\">th<\/span><span style=\"font-weight: 400;\"> to (n+1)<\/span><span style=\"font-weight: 400;\">th<\/span><span style=\"font-weight: 400;\"> node and point the previous of (n+1)<\/span><span style=\"font-weight: 400;\">th<\/span><span style=\"font-weight: 400;\"> node to the(n-1)<\/span><span style=\"font-weight: 400;\">th<\/span><span style=\"font-weight: 400;\"> node. Point previous and next of n<\/span><span style=\"font-weight: 400;\">th<\/span><span style=\"font-weight: 400;\"> node to null.<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img07.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-95316\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img07.jpg\" alt=\"delet node in doubly linked list\" width=\"1200\" height=\"400\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img07.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img07-300x100.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img07-1024x341.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img07-150x50.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img07-768x256.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img07-720x240.jpg 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img07-520x173.jpg 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img07-320x107.jpg 320w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img08.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-95317\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img08.jpg\" alt=\"Doubly linked list\" width=\"1100\" height=\"300\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img08.jpg 1100w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img08-300x82.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img08-1024x279.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img08-150x41.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img08-768x209.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img08-720x196.jpg 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img08-520x142.jpg 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-normal-img08-320x87.jpg 320w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/a><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">void DeleteAtPosition(int pos)  \r\n{  \r\n    struct node *ptr,*ptr1;   \r\n    ptr=head;  \r\n    for(i=0;i&lt;pos;i++)  \r\n    {  \r\n        ptr1 = ptr;       \r\n        ptr = ptr-&gt;next;  \r\n    }  \r\n    ptr1 -&gt;next = ptr -&gt; next; \r\n    ptr1 -&gt; next -&gt; previous = ptr1; \r\n    free(ptr);   \r\n}<\/pre>\n<h3>Searching node in Doubly Linked List<\/h3>\n<p><span style=\"font-weight: 400;\">Traverse from either the head of the doubly linked list or from the tale of the doubly linked list and compare the search element to every node. If found, return true else return false.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Boolean flag= false;\r\nbool search(struct Node* head, int x)\r\n{\r\n    struct Node* current = head;\r\n    while (current != NULL)\r\n    {\r\n        if (current-&gt;key == x)\r\n          {\r\n            flag = true;\r\n            break;\r\n    }\r\n}\r\n    return flag;\r\n}<\/pre>\n<h3>Display<\/h3>\n<p><span style=\"font-weight: 400;\">Start Traversing from the head of the doubly linked list and keep on returning each node.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">void display(struct Node* disp)\r\n{\r\n    while (disp != NULL) \r\n{\r\n        printf(\" %d \", disp -&gt; data);\r\n        disp = disp -&gt; next;\r\n    }\r\n}<\/pre>\n<h3>Implementation of doubly linked list in C<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n  \r\nstruct Node\r\n {\r\n    int data;\r\n    struct Node* next;\r\n    struct Node* previous;\r\n};\r\n  \r\nint main()\r\n{\r\n    struct Node* Node1 = NULL;\r\n    struct Node* Node2 = NULL;\r\n    struct Node* Node3 = NULL;\r\n  \r\n    \r\n   Node1 = (struct Node*)malloc(sizeof(struct Node));\r\n   Node2 = (struct Node*)malloc(sizeof(struct Node));\r\n   Node3 = (struct Node*)malloc(sizeof(struct Node));\r\n  \r\n     \r\n    Node1 -&gt; data = 1; \r\n    Node1 -&gt; next = Node2; \r\n    Node1 -&gt; previous = NULL;  \r\n       \r\n    Node2 -&gt; data = 2;\r\n    Node2 -&gt; next = Node3;\r\n    Node2 -&gt; previous = Node1; \r\n     \r\n    Node3 -&gt; data = 3; \r\n    Node3 -&gt; next = NULL;\r\n    Node3 -&gt; previous = Node2;\r\n\r\n    display(Node1);\r\n    return 0;\r\n}\r\n\r\nvoid display(struct Node* disp)\r\n{\r\n    while (disp != NULL) \r\n{\r\n        printf(\" %d \", disp -&gt; data);\r\n        disp = disp -&gt; next;\r\n    }\r\n}<\/pre>\n<h3>Implementation of doubly linked list in Python<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class Node:\r\n    def __init__(self, data):\r\n        self.data = data  \r\n        self.next = None \r\n        self.previous = None \r\n  \r\nclass SinglyLinkedList:    \r\n    def __init__(self):\r\n        self.head = None\r\n    \r\n    def DisplayList(self):\r\n        temp = self.head\r\n        while (temp):\r\n            print (temp.data)\r\n            temp = temp.next\r\n  \r\nif __name__=='__main__':\r\n  \r\n    dll = SinglyLinkedList()\r\n  \r\n    dll.head = Node(\u201cDATA\u201d)\r\n    Node2 = Node(\u201cFLAIR\u201d)\r\n    Node3 = Node(\u201cDLL\u201d)\r\n  \r\n    dll.head.next = Node2; \r\n    Node2.next = Node3; \r\n \r\n    dll.head.previous = None;\r\n    Node2.previous = dll.head;\r\n    Node3.previous = Node2;\r\n \r\n    dll.DisplayList()<\/pre>\n<h3>Doubly linked list implementation in C++<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;bits\/stdc++.h&gt;\r\nusing namespace std;\r\n  \r\nclass Node {\r\npublic:\r\n    string data;\r\n    Node* next;\r\n    Node* previous;\r\n};\r\n  \r\nvoid displayList(Node* n)\r\n{\r\n    while (n != NULL)\r\n {\r\n        cout &lt;&lt; n -&gt; data &lt;&lt; \" \";\r\n        n = n -&gt; next;\r\n    }\r\n}\r\n \r\nint main()\r\n{\r\n    Node* Node1 = NULL;\r\n    Node* Node2 = NULL;\r\n    Node* Node3 = NULL;\r\n  \r\n    Node1 = new Node();\r\n    Node2 = new Node();\r\n    Node3 = new Node();\r\n  \r\n    Node1 -&gt; data = \u201cDATA\u201d; \r\n    Node1 -&gt; next = Node2; \r\n    Node1 -&gt; previous = NULL;\r\n  \r\n    Node2 -&gt; data = \u201cFLAIR\u201d; \r\n    Node2 -&gt; next = Node3;\r\n    Node2 -&gt; previous = Node1;\r\n  \r\n    Node3 -&gt; data = \u201cDLL\u201d; \r\n    Node3 -&gt; next = NULL;\r\n    Node3 -&gt; previous = Node2;\r\n  \r\n    displayList(Node1);\r\n  \r\n    return 0;\r\n}<\/pre>\n<h3>Implementation of doubly linked list in Java<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">public class DoublyLinkedList {\r\n    Node head; \r\n \r\n    static class Node {\r\n        String data;\r\n        Node next;\r\n        Node previous;\r\n        \r\n        Node(String str)\r\n        {\r\n            data = str;\r\n            next = null;\r\n        } \r\n    }\r\n  \r\n    \r\n    public void displayList()\r\n    {\r\n        Node n = head;\r\n        while (n != null) \r\n        {\r\n            System.out.print(n.data + \" \");\r\n            n = n.next;\r\n        }\r\n    }\r\n  \r\n    public static void main(String[] args)\r\n    {\r\n        \r\n        DoublyLinkedList dllist = new DoublyLinkedList();\r\n  \r\n        Node Node1 = new Node(\"DATA\");        \r\n        Node Node2 = new Node(\"FLAIR\");\r\n        Node Node3 = new Node(\"DLL\");\r\n \r\n        dllist.head = Node1;\r\n  \r\n        dllist.head.next = Node2; \r\n        Node2.next = Node3; \r\n \r\n        Node2.previous = Node1;\r\n        Node3.previous = Node2;\r\n  \r\n        dllist.displayList();\r\n    }\r\n}<\/pre>\n<h3>Advantages of Doubly linked list<\/h3>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Both forward and backward traversing is possible.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Insert and Delete operations are highly efficient as compared to the singly linked list.<\/span><\/li>\n<\/ul>\n<h3>Disadvantages of Doubly linked list<\/h3>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Every node requires large memory blocks since it has a previous pointer too. This makes it a little memory inefficient.\u00a0<\/span><\/li>\n<\/ul>\n<h3>Singly-linked list Vs Doubly linked list<\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>Singly-linked list<\/b><\/td>\n<td><b>Doubly linked list<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Only one-way traversing is possible.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Traversing is possible both ways.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Requires only one pointer per node leading to less memory utilization.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Requires two pointers per node leading to more memory utilization.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">The worst-case time complexity for inserting or deleting a node is O(n)which makes it less efficient.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The worst-case time complexity for inserting or deleting a node is O(1), which makes it more efficient than a singly linked list.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">It is implemented on stacks.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">It is implemented on stacks, heap, and binary trees.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Conclusion<\/h3>\n<p><span style=\"font-weight: 400;\">A doubly linked list is a more efficient version of a singly linked list. Although it requires more memory, Insert and delete operations are carried out in constant time complexity. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here we also learned the step-by-step procedure for insertion and deletion of nodes at different positions in an already existing doubly linked list.\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have already seen the singly linked list in our previous article. A doubly linked list is a complex version of a singly linked list. Unlike a singly linked list, a doubly-linked list has&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":95024,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24020],"tags":[24339,4038,24338,24341,24340],"class_list":["post-94981","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-structure-tutorials","tag-applications-of-doubly-linked-list","tag-doubly-linked-list","tag-doubly-linked-list-in-data-structure","tag-operations-on-doubly-linked-list","tag-single-linked-list-vs-doubly-linked-list"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Doubly Linked List in Data Structure - DataFlair<\/title>\n<meta name=\"description\" content=\"Doubly linked list is a type of linked list in which a node contains pointer to previous as well as next node in the sequence. Learn more.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Doubly Linked List in Data Structure - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Doubly linked list is a type of linked list in which a node contains pointer to previous as well as next node in the sequence. Learn more.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-24T03:30:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-in-DS.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Doubly Linked List in Data Structure - DataFlair","description":"Doubly linked list is a type of linked list in which a node contains pointer to previous as well as next node in the sequence. Learn more.","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:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/","og_locale":"en_US","og_type":"article","og_title":"Doubly Linked List in Data Structure - DataFlair","og_description":"Doubly linked list is a type of linked list in which a node contains pointer to previous as well as next node in the sequence. Learn more.","og_url":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-05-24T03:30:04+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-in-DS.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9"},"headline":"Doubly Linked List in Data Structure","datePublished":"2021-05-24T03:30:04+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/"},"wordCount":884,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-in-DS.jpg","keywords":["Applications of Doubly linked list","Doubly linked list","Doubly linked list in data structure","Operations on Doubly Linked list","Single Linked List vs Doubly linked list"],"articleSection":["Data Structure Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/","url":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/","name":"Doubly Linked List in Data Structure - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-in-DS.jpg","datePublished":"2021-05-24T03:30:04+00:00","description":"Doubly linked list is a type of linked list in which a node contains pointer to previous as well as next node in the sequence. Learn more.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-in-DS.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Doubly-linked-list-in-DS.jpg","width":1200,"height":628,"caption":"Doubly linked list in Data Structure"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/doubly-linked-list-in-data-structure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Data Structure Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/data-structure-tutorials\/"},{"@type":"ListItem","position":3,"name":"Doubly Linked List in Data Structure"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team is a group of passionate educators and industry experts dedicated to providing high-quality online learning resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With years of experience in the field, the team aims to simplify complex topics and help learners advance their careers. At DataFlair, we believe in empowering students and professionals with the knowledge and skills needed to thrive in today\u2019s fast-paced tech industry. Follow us for Free courses, expert insights, tutorials, and practical tips to boost your learning journey.","url":"https:\/\/data-flair.training\/blogs\/author\/datafbdad\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/94981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=94981"}],"version-history":[{"count":4,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/94981\/revisions"}],"predecessor-version":[{"id":95318,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/94981\/revisions\/95318"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/95024"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=94981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=94981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=94981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}