{"id":4913,"date":"2021-09-10T11:34:51","date_gmt":"2021-09-10T11:34:51","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=4913"},"modified":"2023-05-26T07:07:47","modified_gmt":"2023-05-26T07:07:47","slug":"implementation-of-deque-using-doubly-linked-list","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/","title":{"rendered":"Implementation of Deque Using Doubly Linked List"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645000585664-Article_134.png\" alt=\"\" \/><\/p>\n<p>Implementing a deque (double-ended queue) using a doubly linked list is a common approach in computer programming. A deque is a data structure that allows the insertion and removal of elements from both ends, making it versatile for various applications.<\/p>\n<p>To implement a deque using  doubly linked list, we utilize the concept of a doubly linked list, which consists of nodes that contain references to both the previous and next nodes. Each node in the doubly linked list holds an element of the deque.<\/p>\n<h2>Deque Implementation using Doubly Linked List<\/h2>\n<p>In this problem, we have to implement deque using doubly linked list.<\/p>\n<p>Deque (doubly ended queue) is a linear data structure that stores data in a sequential manner, and It provides the facility to add or remove an element from the front or the back of it in constant time complexity. All the basic functionalities of deque are discussed below.<\/p>\n<h3>Functions for Implementing Deque Doubly Linked List<\/h3>\n<p>There are various functions that we need for implementation of deque, let us discuss each of them individually.<\/p>\n<p><strong>insertFront(int x):<\/strong> This function adds data at the beginning of the deque.<\/p>\n<ul>\n<li>For example, let\u2019s say in the deque, the elements are arranged in order &#8211; 2,6,3,8.<\/li>\n<li>If we want to insert an integer \u20187\u2019 in front of the deque, we can do that using the insertFront(7) function.<\/li>\n<li>After insertion at front the arrangement of elements in deque will become &#8211; 7,2,6,3,8.<\/li>\n<\/ul>\n<p><strong>insertRear(int x):<\/strong> This function adds data at the end of the deque.<\/p>\n<ul>\n<li>For example, let\u2019s say in the deque, the elements are arranged in order &#8211; 2,6,3,8.<\/li>\n<li>If we want to insert an integer \u20187\u2019 in the end of the deque, we can do that using the insertRear(7) function.<\/li>\n<li>After insertion at end, the arrangement of elements in deque will become &#8211; 2,6,3,8,7<\/li>\n<\/ul>\n<p><strong>deleteFront()<\/strong>: This function deletes data from the beginning of the deque.<\/p>\n<\/p>\n<ul>\n<li>For example, let\u2019s say in the deque, the elements are arranged in order &#8211; 2,6,3,8.<\/li>\n<li>If we want to delete an element from the front of the deque, we can do that using the deleteFront() function.<\/li>\n<li>After deletion from the front, the arrangement of elements in deque will become &#8211; 6,3,8.<\/li>\n<\/ul>\n<p><strong>deleteRear()<\/strong>: This function deletes data from the end of the deque.<\/p>\n<ul>\n<li>For example, let\u2019s say in the deque, the elements are arranged in order &#8211; 2,6,3,8.<\/li>\n<li>If we want to delete an element from the end of the deque, we can do that using the deleteRear() function.<\/li>\n<li>After deletion from the end, the arrangement of elements in deque will become &#8211; 2,6,3<\/li>\n<\/ul>\n<p><strong>getFront()<\/strong>: This function will return the front element present in the deque.<\/p>\n<ul>\n<li>For example, let\u2019s say in the deque, the elements are arranged in order &#8211; 2,6,3,8.<\/li>\n<li>So, after calling this function, It will return \u20182\u2019 as it is present at the beginning of the deque.<\/li>\n<\/ul>\n<p><strong>getRear()<\/strong>: This function will return the last element present in the deque.<\/p>\n<ul>\n<li>For example, let us say that in our deque, the elements are arranged in order &#8211; 2,6,3,8.<\/li>\n<li>So, after calling this function, It will return \u20188\u2019 as it is present at the end of the deque.<\/li>\n<\/ul>\n<p><strong>isEmpty()<\/strong>: It returns true if the deque is empty and false when it has at least one element.<\/p>\n<p><strong>size()<\/strong>: It returns the total number of elements present in the deque.<\/p>\n<p>Now that we have seen all the functions we have to build for deque doubly linked list, let&#8217;s move to the approach section for deque using doubly linked list.<\/p>\n<p>Also, before directly jumping to the approach section, try to do  implementation of deque  by yourself. If stuck, no problem, we will thoroughly see in the next section how we can approach this deque doubly linked list.<\/p>\n<h3>Approach:<\/h3>\n<ul>\n<li>We need to keep track of the head as well as the tail of our doubly linked list.<\/li>\n<li>When an element needs to be inserted at the beginning of the linked list, we need to insert it before the head node, update the head, and increase  the size of the list by one.<\/li>\n<li>When an element needs to be inserted at the end of the linked list, we need to insert it after the tail node, update the tail pointer, and decrease the size of the list by one.<\/li>\n<li>When deleting an element from the beginning, we need to delete the head node and update the head pointer accordingly. Also, after deletion, we have to decrease the size of the list by one.<\/li>\n<li>When deleting an element from the end, we need to delete the tail node and update the tail pointer accordingly. Also, after deletion, we have to decrease the size of the list by one.<\/li>\n<\/ul>\n<h2>Algorithm to Deque using Doubly Linked List:<\/h2>\n<ol>\n<li>Initialize two pointers named \u2018head\u2019 and \u2018tail\u2019 with NULL and variable \u2018size\u2019 with zero <\/li>\n<li><strong>insertFront for deque doubly linked list<\/strong> function<br \/>\na. Create a new node<br \/>\nb. Check if this node is NULL or not. <\/p>\n<ul>\n<li>If it is NULL, it means that memory is full and no further nodes can be created.<\/li>\n<li>If it is not NULL, then check if \u2018head\u2019 is NULL or not.\n<ol>\n<li>If \u2018head\u2019 is NULL, that means this is the first node in the list so, assign the address of this newly created node to \u2018head\u2019 and \u2018tail\u2019<\/li>\n<li>If \u2018head\u2019 is not NULL, then\n<ul>\n<li>Assign the next pointer of the new node to head.<\/li>\n<li>Assign the previous pointer of the head to the new node.<\/li>\n<li>Update the \u2018head\u2019 to the new node\u2019s address<\/li>\n<\/ul>\n<\/li>\n<li>Increment the \u2018size\u2019 variable by one.<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>insertRear for deque doubly linked list<\/strong> function<br \/>\na. Create a new node.<br \/>\nb. Check if this node is NULL or not.<\/p>\n<ul>\n<li>If it is NULL, it means that memory is full and no further nodes can be created.<\/li>\n<li>If it is not NULL, then check if \u2018tail\u2019 is NULL or not\n<ol>\n<li>If \u2018tail\u2019 is NULL, that means this is the first node in the list so, assign the address of this newly created node to \u2018head\u2019 and \u2018tail\u2019<\/li>\n<li>If \u2018tail\u2019 is not NULL then\n<ul>\n<li>Assign the next pointer of the tail to the new node.<\/li>\n<li>Assign the previous pointer of the new node to the tail.<\/li>\n<li>Update the \u2018tail\u2019 to the new node\u2019s address<\/li>\n<\/ul>\n<\/li>\n<li>Increment the \u2018size\u2019 variable by one.<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>deleteFront for deque doubly linked list<\/strong> function<br \/>\na. Check if the list is empty or not<\/p>\n<ul>\n<li>If the list is empty, return from the function.<\/li>\n<li>Else, store the address of \u2018head\u2019 in a \u2018temp\u2019 variable and advance \u2018head\u2019 by one node using head = head\u2192next.<\/li>\n<li>If \u2018head\u2019 becomes NULL, that means only one node existed in the list, so, make the \u2018tail\u2019 NULL as well.<\/li>\n<li>Else, make previous of head as NULL.<\/li>\n<li>Free the memory from the \u2018temp\u2019 node.<\/li>\n<li>Decrement the \u2018size\u2019 variable by one.<\/li>\n<\/ul>\n<\/li>\n<li><strong>deleteRear for deque doubly linked list<\/strong> function<br \/>\na. Check if the list is empty or not<\/p>\n<ul>\n<li>If the list is empty, return from the function<\/li>\n<li>Else, store the address of \u2018tail\u2019 in a \u2018temp\u2019 variable and advance \u2018tail\u2019 by one node using tail = tail\u2192prev.<\/li>\n<li>If \u2018tail\u2019 becomes NULL, that means only one node existed in the list, so, make the \u2018head\u2019 NULL as well.<\/li>\n<li>Else, make next of \u2018tail\u2019  NULL.<\/li>\n<li>Free the memory from the \u2018temp\u2019 node.<\/li>\n<li>Decrement the \u2018size\u2019 variable by one.<\/li>\n<\/ul>\n<\/li>\n<li><strong>getFront for deque doubly linked list<\/strong> function<br \/>\na. Check if the list is empty or not<\/p>\n<ul>\n<li>If it is empty, return from the function saying that the list is empty<\/li>\n<li>Else, return the value present in the \u2018head\u2019 node<\/li>\n<\/ul>\n<\/li>\n<li><strong>getRear<\/strong> function<br \/>\na. Check if the list is empty or not<\/p>\n<ul>\n<li>If it is empty, return from the function saying that the list is empty<\/li>\n<li>Else, return the value present in the \u2018tail\u2019 node<\/li>\n<\/ul>\n<\/li>\n<li><strong>isEmpty<\/strong> function<br \/>\na. If the size is zero, return true.<br \/>\nb. If the size is not zero, return false.<\/li>\n<li><strong>Size for deque doubly linked list<\/strong>:<br \/>\na. Return the \u2018size\u2019 variable.<\/li>\n<\/ol>\n<h3>Dry Run for Implementation of Deque:<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Implementation-of-Deque-Using-Doubly-Linked-List-1.png\" alt=\"\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Implementation-of-Deque-Using-Doubly-Linked-List-2.png\" alt=\"\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Implementation-of-Deque-Using-Doubly-Linked-List-3.png\" alt=\"\" \/><\/p>\n<h2>Code Implementation for Deque using Doubly Linked List:<\/h2>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_4914 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_4914 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_4914 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_4914 .wpsm_nav-tabs > li.active > a, #tab_container_4914 .wpsm_nav-tabs > li.active > a:hover, #tab_container_4914 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_4914 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_4914 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_4914 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_4914 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_4914 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_4914 .wpsm_nav-tabs > li > a:hover , #tab_container_4914 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_4914 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_4914 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_4914 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_4914 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_4914 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_4914 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_4914 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_4914 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_4914 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_4914 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_4914 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_4914\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_4914\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_4914_1\" aria-controls=\"tabs_desc_4914_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>C++<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_4914\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_4914_1\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"cpp\"} -->\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\r\n#include <bits\/stdc++.h>\r\nusing namespace std;\r\n\r\n\/\/ Node structure of a doubly-linked list\r\nclass Node\r\n{\r\n    public:\r\n\tint data;\r\n\tNode *prev, *next;\r\n\t\/\/ constructor\r\n\tNode(int x)\r\n\t{\r\n\t\tdata = x;\r\n\t\tprev = NULL;\r\n\t\tnext = NULL;\r\n\t}\r\n};\r\n\r\n\/\/ A class for deque\r\nclass Deque\r\n{\r\n\tNode* head;\r\n\tNode* tail;\r\n\tint Size;\r\n\r\npublic:\r\n\t\/\/initialize deque as stated in step 1 \r\n\tDeque()\r\n\t{\r\n\t\thead = tail = NULL;\r\n\t\tSize = 0;\r\n\t}\r\n\r\n\t\/\/ exhaustive list of functions as discussed above  \r\n\tvoid insertFront(int data);\r\n\tvoid insertRear(int data);\r\n\tvoid deleteFront();\r\n\tvoid deleteRear();\r\n\tint getFront();\r\n\tint getRear();\r\n\tint size();\r\n\tbool isEmpty();\r\n};\r\n\r\n\/\/ this function will check if the deque is empty or not\r\nbool Deque::isEmpty()\r\n{\r\n\treturn (head == NULL);\r\n}\r\n\r\n\/\/ This function returns total count of elements in the deque\r\nint Deque::size()\r\n{\r\n\treturn Size;\r\n}\r\n\r\n\/\/ This function will insert the element at the front of the    \/\/ deque\r\nvoid Deque::insertFront(int data)\r\n{\r\n\tNode* newNode = new Node(data);\r\n\t\/\/ if newNode is Null then no nodes can be created as \r\n     \/\/ memory is full \r\n\tif (newNode == NULL)\r\n\t\tcout << \"OverFlow&#92;n\";\r\n\telse\r\n\t{\r\n\t\t\/\/ If deque is empty\r\n\t\tif (head == NULL)\r\n\t\t\ttail = head = newNode;\r\n\r\n\t\t\/\/ Inserts an element at the beginning of the list\r\n\t\telse\r\n\t\t{\r\n\t\t\tnewNode->next = head;\r\n\t\t\thead->prev = newNode;\r\n\t\t\thead = newNode;\r\n\t\t}\r\n\r\n\t\t\/\/ Increase size by 1\r\n\t\tSize++;\r\n\t}\r\n}\r\n\r\n\/\/ This function will insert the element at the back of the    \/\/ deque\r\nvoid Deque::insertRear(int data)\r\n{\r\n\tNode* newNode = new Node(data);\r\n\t\/\/ if newNode is Null then no nodes can be created as \r\n     \/\/ memory is full\r\n\tif (newNode == NULL)\r\n\t\tcout << \"OverFlow&#92;n\";\r\n\telse\r\n\t{\r\n\t\t\/\/ If deque is empty\r\n\t\tif (tail == NULL)\r\n\t\t\thead = tail = newNode;\r\n\r\n\t\t\/\/ Inserts an element at the end of the list\r\n\t\telse\r\n\t\t{\r\n\t\t\tnewNode->prev = tail;\r\n\t\t\ttail->next = newNode;\r\n\t\t\ttail = newNode;\r\n\t\t}\r\n\t\t\/\/ Increase size by 1\r\n\t\tSize++;\r\n\t}\r\n}\r\n\r\n\/\/ This function will delete an element from front of the       \/\/ deque\r\nvoid Deque::deleteFront()\r\n{\r\n\t\/\/ If there are no elements in deque, we cannot delete \r\n\t\/\/ anything\r\n\tif (isEmpty())\r\n\t\tcout << \"UnderFlow&#92;n\";\r\n\r\n\t\/\/ Delete the front node and update the \u2018head\u2019 pointer as  \r\n     \/\/ well as update the links \r\n\telse\r\n\t{\r\n\t\tNode* temp = head;\r\n\t\thead = head->next;\r\n\r\n\t\t\/\/ If only one element was present\r\n\t\tif (head == NULL)\r\n\t\t\ttail = NULL;\r\n\t\telse\r\n\t\t\thead->prev = NULL;\r\n\t\tfree(temp);\r\n\r\n\t\t\/\/ Decrease \u2018size\u2019 by 1\r\n\t\tSize--;\r\n\t}\r\n}\r\n\r\n\/\/ This function will delete an element from back of the       \/\/ deque\r\nvoid Deque::deleteRear()\r\n{\r\n\t\/\/ If there are no elements in deque, we cannot delete \r\n\t\/\/ anything\r\n\tif (isEmpty())\r\n\t\tcout << \"UnderFlow&#92;n\";\r\n\r\n\t\/\/ Delete the back node and update the \u2018tail\u2019 pointer as  \r\n     \/\/ well as update the links\r\n\telse\r\n\t{\r\n\t\tNode* temp = tail;\r\n\t\ttail = tail->prev;\r\n\r\n\t\t\/\/ If only one element was present\r\n\t\tif (tail == NULL)\r\n\t\t\thead = NULL;\r\n\t\telse\r\n\t\t\ttail->next = NULL;\r\n\t\tfree(temp);\r\n\r\n\t\t\/\/ Decrease \u2018size\u2019 by 1\r\n\t\tSize--;\r\n\t}\r\n}\r\n\r\n\/\/ this function will return front element of the deque\r\nint Deque::getFront()\r\n{\r\n\t\/\/ If there are no elements in deque, return -1\r\n\tif (isEmpty())\r\n\t\treturn -1;\r\n\treturn head->data;\r\n}\r\n\r\n\/\/ this function will return rear element of the deque\r\nint Deque::getRear()\r\n{\r\n\t\/\/ If there are no elements in deque, return -1\r\n\tif (isEmpty())\r\n\t\treturn -1;\r\n\treturn tail->data;\r\n}\r\n\r\n\r\nint main()\r\n{\r\n\tDeque dq;\r\n\tcout << \"Insert element '2' at rear end&#92;n\";\r\n\tdq.insertRear(2);\r\n\r\n\tcout << \"Insert element '0' at rear end&#92;n\";\r\n\tdq.insertRear(0);\r\n\r\n\tcout << \"Rear end element: \"\r\n\t\t<< dq.getRear() << endl;\r\n\r\n\tdq.deleteRear();\r\n\tcout << \"After deleting rear element new rear\"\r\n\t\t<< \" is: \" << dq.getRear() << endl;\r\n\r\n\tcout << \"Inserting element '27' at front end &#92;n\";\r\n\tdq.insertFront(27);\r\n\r\n\tcout << \"Front end element: \"\r\n\t\t<< dq.getFront() << endl;\r\n\r\n\tcout << \"Number of elements in Deque: \"\r\n\t\t<< dq.size() << endl;\r\n\r\n\tdq.deleteFront();\r\n\tcout << \"After deleting front element new \"\r\n\t\t<< \"front is: \" << dq.getFront() << endl;\r\n\r\n\treturn 0;\r\n}\r\n\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\r\n\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_4914 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_4914 a\"),jQuery(\"#tab-content_4914\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t\n<p><strong>Output of deque using doubly linked list &#8211;<\/strong><\/p>\n<p>Insert element &#8216;2&#8217; at rear end<br \/>\nInsert element &#8216;0&#8217; at rear end<br \/>\nRear end element: 0<br \/>\nAfter deleting rear element new rear is: 2<br \/>\nInserting element &#8217;27&#8217; at front end<br \/>\nFront end element: 27<br \/>\nNumber of elements in Deque: 2<br \/>\nAfter deleting front element new front is: 2<\/p>\n<p><strong>Time complexity<\/strong>: For all operations except erase(), the time complexity is O(1). For erase() time complexity is O(n).<\/p>\n<p>**Conclusion**<br \/>\nIn conclusion, implementing a deque (double-ended queue) using a doubly linked list provides an efficient and versatile data structure that supports insertion and removal of elements from both ends. The use of a doubly linked list allows for easy traversal in both directions, making the implementation straightforward and efficient.<\/p>\n<p>By utilizing the push_front, push_back, pop_front, and pop_back operations, we can add and remove elements from the front and back of the deque in constant time. Additionally, accessing the front and back elements is also efficient with constant time complexity.<\/p>\n<p>The implementation of a deque using a doubly linked list is beneficial in scenarios where fast insertion and removal of elements at both ends are required. It offers flexibility in managing collections of data and can be used in various applications, such as queueing systems, simulations, and data processing tasks.<\/p>\n<h2>FAQs related to Deque<\/h2>\n<ol>\n<li><strong>Is Deque a doubly linked list?<\/strong><\/li>\n<p>We can say that by using a doubly linked list we can implement a deque and we can also call it a head-tail linked list.<\/p>\n<li><strong>How is a doubly linked list different from a deque?<\/strong><\/li>\n<p>Basically, a dequeue only allows insertion (and deletion) at the front and back, while a list allows insertion in the middle of it.<\/p>\n<li><strong>In which data structure insertion or deletion of an element can be done in constant time?<\/strong><\/li>\n<p>Doubly linked list<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Implementing a deque (double-ended queue) using a doubly linked list is a common approach in computer programming. A deque is a data structure that allows the insertion and removal of elements from both ends, making it versatile for various applications. To implement a deque using doubly linked list, we utilize the concept of a doubly [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[125],"tags":[],"class_list":["post-4913","post","type-post","status-publish","format-standard","hentry","category-linked-list"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Implementation of Deque Using Doubly Linked List<\/title>\n<meta name=\"description\" content=\"Learn how to implement a Deque using a Doubly Linked List. This blog explains how you can implement a Deque using Doubly Linked List most optimally.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Implementation of Deque Using Doubly Linked List\" \/>\n<meta property=\"og:description\" content=\"Learn how to implement a Deque using a Doubly Linked List. This blog explains how you can implement a Deque using Doubly Linked List most optimally.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/\" \/>\n<meta property=\"og:site_name\" content=\"PrepBytes Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prepbytes0211\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-10T11:34:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-26T07:07:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645000585664-Article_134.png\" \/>\n<meta name=\"author\" content=\"Prepbytes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prepbytes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/\"},\"author\":{\"name\":\"Prepbytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\"},\"headline\":\"Implementation of Deque Using Doubly Linked List\",\"datePublished\":\"2021-09-10T11:34:51+00:00\",\"dateModified\":\"2023-05-26T07:07:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/\"},\"wordCount\":1622,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645000585664-Article_134.png\",\"articleSection\":[\"Linked list articles\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/\",\"name\":\"Implementation of Deque Using Doubly Linked List\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645000585664-Article_134.png\",\"datePublished\":\"2021-09-10T11:34:51+00:00\",\"dateModified\":\"2023-05-26T07:07:47+00:00\",\"description\":\"Learn how to implement a Deque using a Doubly Linked List. This blog explains how you can implement a Deque using Doubly Linked List most optimally.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645000585664-Article_134.png\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645000585664-Article_134.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/43.205.93.38\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linked list articles\",\"item\":\"https:\/\/prepbytes.com\/blog\/category\/linked-list\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Implementation of Deque Using Doubly Linked List\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/43.205.93.38\/#website\",\"url\":\"http:\/\/43.205.93.38\/\",\"name\":\"PrepBytes Blog\",\"description\":\"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING\",\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/43.205.93.38\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/43.205.93.38\/#organization\",\"name\":\"Prepbytes\",\"url\":\"http:\/\/43.205.93.38\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"contentUrl\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"width\":160,\"height\":160,\"caption\":\"Prepbytes\"},\"image\":{\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/prepbytes0211\/\",\"https:\/\/www.instagram.com\/prepbytes\/\",\"https:\/\/www.linkedin.com\/company\/prepbytes\/\",\"https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\",\"name\":\"Prepbytes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"caption\":\"Prepbytes\"},\"url\":\"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Implementation of Deque Using Doubly Linked List","description":"Learn how to implement a Deque using a Doubly Linked List. This blog explains how you can implement a Deque using Doubly Linked List most optimally.","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:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/","og_locale":"en_US","og_type":"article","og_title":"Implementation of Deque Using Doubly Linked List","og_description":"Learn how to implement a Deque using a Doubly Linked List. This blog explains how you can implement a Deque using Doubly Linked List most optimally.","og_url":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2021-09-10T11:34:51+00:00","article_modified_time":"2023-05-26T07:07:47+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645000585664-Article_134.png","type":"","width":"","height":""}],"author":"Prepbytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Prepbytes","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/"},"author":{"name":"Prepbytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e"},"headline":"Implementation of Deque Using Doubly Linked List","datePublished":"2021-09-10T11:34:51+00:00","dateModified":"2023-05-26T07:07:47+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/"},"wordCount":1622,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645000585664-Article_134.png","articleSection":["Linked list articles"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/","url":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/","name":"Implementation of Deque Using Doubly Linked List","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645000585664-Article_134.png","datePublished":"2021-09-10T11:34:51+00:00","dateModified":"2023-05-26T07:07:47+00:00","description":"Learn how to implement a Deque using a Doubly Linked List. This blog explains how you can implement a Deque using Doubly Linked List most optimally.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645000585664-Article_134.png","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645000585664-Article_134.png"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/implementation-of-deque-using-doubly-linked-list\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/43.205.93.38\/"},{"@type":"ListItem","position":2,"name":"Linked list articles","item":"https:\/\/prepbytes.com\/blog\/category\/linked-list\/"},{"@type":"ListItem","position":3,"name":"Implementation of Deque Using Doubly Linked List"}]},{"@type":"WebSite","@id":"http:\/\/43.205.93.38\/#website","url":"http:\/\/43.205.93.38\/","name":"PrepBytes Blog","description":"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING","publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/43.205.93.38\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/43.205.93.38\/#organization","name":"Prepbytes","url":"http:\/\/43.205.93.38\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/","url":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","contentUrl":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","width":160,"height":160,"caption":"Prepbytes"},"image":{"@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/prepbytes0211\/","https:\/\/www.instagram.com\/prepbytes\/","https:\/\/www.linkedin.com\/company\/prepbytes\/","https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA"]},{"@type":"Person","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e","name":"Prepbytes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","caption":"Prepbytes"},"url":"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/"}]}},"_links":{"self":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/4913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/comments?post=4913"}],"version-history":[{"count":9,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/4913\/revisions"}],"predecessor-version":[{"id":16546,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/4913\/revisions\/16546"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=4913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=4913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=4913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}