{"id":4676,"date":"2021-09-02T09:16:36","date_gmt":"2021-09-02T09:16:36","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=4676"},"modified":"2023-11-27T12:43:52","modified_gmt":"2023-11-27T12:43:52","slug":"construct-a-doubly-linked-list-from-2d-matrix","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/","title":{"rendered":"Construct A Doubly Linked List From 2D Matrix"},"content":{"rendered":"<p>Constructing a doubly linked list from a 2D matrix is a fascinating exercise that involves transforming a two-dimensional data structure into a linked list, specifically a doubly linked list. This process requires traversing through the matrix elements, creating nodes, and linking them in such a way that they form a linked list where each node maintains connections to both its previous and next nodes. Implementing this conversion not only enhances understanding of linked list concepts but also demonstrates the versatility of data structure manipulation. In this article, we will delve into the step-by-step process of constructing a doubly linked list from a 2D matrix, elucidating the methodology and providing a clear, concise implementation guide.<\/p>\n<h2>How To Construct 2D Doubly Linked List?<\/h2>\n<p>We are provided with a 2D Matrix, and we need to construct a doubly linked list with 4 pointers, namely:<\/p>\n<ul>\n<li>up<\/li>\n<li>down<\/li>\n<li>left<\/li>\n<li>right<\/li>\n<\/ul>\n<p>Each node should be connected to its adjacent nodes using <a href=\"https:\/\/prepbytes.com\/blog\/linked-list\/iteratively-reverse-a-linked-list-using-only-2-pointers\/\" title=\"these 4 pointers\">these 4 pointers<\/a>.<\/p>\n<p>Learn programming languages online and consider Example:<\/p>\n<h4>Input 2D Matrix:<\/h4>\n<p><strong>12 11 10<br \/>\n1 2 3<br \/>\n6 8 9<\/strong><\/p>\n<h4>Output Doubly Linked List:<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Construct-A-Doubly-Linked-List-From-2D-Matrix.png\" alt=\"\" \/><\/p>\n<p>We are given a 2D Matrix with N rows and M columns. Every element at index i, j (i.e., matrix[i][j]) needs to be changed into a node, and it should be linked to all its adjacent cells using 4 pointers given to us.<\/p>\n<ul>\n<li>up<\/li>\n<li>left<\/li>\n<li>right<\/li>\n<li>down<\/li>\n<\/ul>\n<p>For example, We are given a Matrix with 3 rows and 3 columns:<br \/>\n<strong>12 11 10<br \/>\n1 2 3<br \/>\n6 8 9<\/strong><\/p>\n<ul>\n<li>\n<p>Lets take an example with element matrix[0][0] , i.e 12.<\/p>\n<ul>\n<li>It only has 2 adjacent members, matrix[0][1] and matrix[1][0], i.e., 11 and 1 respectively.<\/li>\n<li>We need to mark Node 12&#8217;s right as 11. Since 11 is right adjacent to 12.<\/li>\n<li>We need to mark Node 12&#8217;s down as 1. Since 1 is lower adjacent to 12.<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Let&#8217;s take another example of the middle element matrix[1][1], i.e. 2<\/p>\n<ul>\n<li>It has 4 adjacent, matrix[1][2], matrix[0][1], matrix[2][1], matrix[1][0], which are right, up, down, and left adjacent of element 2.<\/li>\n<li>We need to mark Node 2&#8217;s right as 3. Since 3 is right adjacent to 2.<\/li>\n<li>We need to mark Node 2&#8217;s up as 11. Since 11 is the up adjacent to 2.<\/li>\n<li>We need to mark Node 2&#8217;s down as 8. Since 8 is the lower adjacent to 2.<\/li>\n<li>We need to mark Node 2&#8217;s left as 1. Since 1 is the left adjacent to 2.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>The Structure of Node will be:<br \/>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_4678 {\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_4678 .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_4678 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_4678 .wpsm_nav-tabs > li.active > a, #tab_container_4678 .wpsm_nav-tabs > li.active > a:hover, #tab_container_4678 .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_4678 .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_4678 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_4678 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_4678 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_4678 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_4678 .wpsm_nav-tabs > li > a:hover , #tab_container_4678 .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_4678 .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_4678 .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_4678 .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_4678 .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_4678 .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_4678 .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_4678 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_4678 .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_4678 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_4678 .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_4678 .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_4678\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_4678\">\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_4678_1\" aria-controls=\"tabs_desc_4678_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_4678\">\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_4678_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\nstruct Node{\r\n    int data;   \/\/ To hold the value of the matrix\r\n\r\n    \/\/ 4 pointers for left, right, up, down for markings.\r\n    Node* left; \r\n    Node* right;\r\n    Node* up;\r\n    Node* down;\r\n\r\n    Node(int x) : data(x), left(NULL), right(NULL), up(NULL), down(NULL) {}\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_4678 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_4678 a\"),jQuery(\"#tab-content_4678\"));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<\/p>\n<p>Let&#8217;s dive into the Approach and Algorithm now.<\/p>\n<h2>Approach and Algorithm To Construct 2D Doubly Linked List<\/h2>\n<p>The Approach for the given problem statement is straightforward.<\/p>\n<ul>\n<li>We create a new Node every time we visit an unvisited cell, starting from <strong>(0,0)<\/strong>.<\/li>\n<li>We change the left pointer <strong>(curr-&gt;left)<\/strong> and up pointer <strong>(curr-&gt;up)<\/strong> of our current node.<\/li>\n<li>Recur for right pointer <strong>(curr-&gt;right)<\/strong> and down pointer <strong>(curr-&gt;down)<\/strong> of our current Node.<\/li>\n<\/ul>\n<h2>Implementation To Construct 2D 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_4679 {\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_4679 .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_4679 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_4679 .wpsm_nav-tabs > li.active > a, #tab_container_4679 .wpsm_nav-tabs > li.active > a:hover, #tab_container_4679 .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_4679 .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_4679 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_4679 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_4679 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_4679 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_4679 .wpsm_nav-tabs > li > a:hover , #tab_container_4679 .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_4679 .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_4679 .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_4679 .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_4679 .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_4679 .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_4679 .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_4679 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_4679 .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_4679 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_4679 .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_4679 .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_4679\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_4679\">\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_4679_1\" aria-controls=\"tabs_desc_4679_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_4679\">\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_4679_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\nstruct Node {\r\n    int data;   \/\/ To hold the value of the matrix\r\n\r\n    \/\/ 4 pointers for left, right, up, down for markings.\r\n    Node* left;\r\n    Node* right;\r\n    Node* up;\r\n    Node* down;\r\n\r\n    Node(int x) : data(x) , left(NULL) , right(NULL) , up(NULL) , down(NULL) {}\r\n};\r\nNode* constructDoublyLinkedList(int mat[][3], int i, int j, Node* last) {\r\n\r\n    \/\/Base Condition\r\n    if (i >= 3 || j >= 3) return NULL;\r\n    \/\/ since matrix is of dimension 3x3.\r\n\r\n    Node* curr = new Node(mat[i][j]);\r\n\r\n    if (j == 0) curr->left = NULL;\r\n    else curr->left = last;\r\n\r\n    if (i == 0) curr->up = NULL;\r\n    else curr->up = last;\r\n\r\n    \/\/Recursively Calling for right and down pointers\r\n\r\n    curr->right = constructDoublyLinkedList(mat, i, j + 1, curr);\r\n    curr->down = constructDoublyLinkedList(mat, i + 1, j, curr);\r\n\r\n    return curr;\r\n\r\n}\r\nvoid print(Node* head) {\r\n    \/\/ Require 2 pointers, downptr and rightptr, for rows and columns.\r\n    Node* downptr = head;\r\n    Node* rightptr;\r\n    while (downptr) {\r\n        rightptr = downptr;\r\n        while (rightptr) {\r\n            cout << (rightptr->data) << \" \";\r\n            rightptr = rightptr->right;\r\n        }\r\n        cout << \"&#92;n\";\r\n        downptr = downptr->down;\r\n    }\r\n}\r\nint main() {\r\n    int matrix[3][3] = {{12,  11  , 10},\r\n        {1 ,  2  ,  3},\r\n        {6 ,  8  ,  9}\r\n    };\r\n\r\n    Node* newList = constructDoublyLinkedList(matrix, 0, 0, NULL);\r\n    print(newList);\r\n\r\n    return 0;\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_4679 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_4679 a\"),jQuery(\"#tab-content_4679\"));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<\/strong><\/p>\n<p><strong>12 11 10<br \/>\n1 2 3<br \/>\n6 8 9<\/strong><\/p>\n<p><strong>Time Complexity To Construct 2D Doubly Linked List:<\/strong> O(n*m), where <strong>n<\/strong> is the number of rows and <strong>m<\/strong> is the number of columns in the given Matrix.<br \/>\n<strong>Space Complexity To Construct 2D Doubly Linked List:<\/strong> O(1), constant space complexity, as no extra space is used.<\/p>\n<p><strong>Conclusion<\/strong><br \/>\nTransforming a 2D matrix into a doubly linked list presents an intriguing problem that highlights the adaptability and versatility of data structures. By systematically traversing the matrix elements and forming nodes linked in a doubly linked list fashion, we bridge the conceptual gap between matrices and linked lists. This process serves as an exercise that strengthens understanding of both data structures and their relationships. The resultant doubly linked list embodies a linear representation of the original matrix, facilitating various operations and manipulations that are inherent to linked lists. Mastery of such transformations not only enriches programming skills but also instills a deeper comprehension of the underlying principles governing data structures.<\/p>\n<h2>FAQs Related to Construct a Doubly Linked List From 2D Matrix<\/h2>\n<p>Here are FAQs Related to Construct a Doubly Linked List From 2D Matrix.<\/p>\n<p><strong>1. Why construct a doubly linked list from a 2D matrix?<\/strong><br \/>\nConstructing a doubly linked list from a 2D matrix helps in representing a matrix in a linear fashion, facilitating easy traversal and manipulation. It also serves as a learning exercise to understand the relationships between different data structures.<\/p>\n<p><strong>2. What are the advantages of using a doubly linked list over a matrix?<\/strong><br \/>\nDoubly linked lists offer flexibility in terms of insertion, deletion, and rearrangement of elements compared to matrices. They occupy memory dynamically, avoiding the need for pre-allocation of fixed space.<\/p>\n<p><strong>3. What challenges might one face in constructing a doubly linked list from a 2D matrix?<\/strong><br \/>\nChallenges may include managing pointers, keeping track of the matrix indices, and ensuring proper linkage between nodes while traversing the matrix elements.<\/p>\n<p><strong>4. Can this conversion be applied to higher-dimensional arrays or matrices?<\/strong><br \/>\nYes, the concept can be extended to higher-dimensional arrays. However, the complexity of traversal and management of pointers increases with the dimensions, making it more intricate.<\/p>\n<p><strong>5. How can I implement this conversion in a programming language?<\/strong><br \/>\nThe implementation involves traversing the matrix, creating nodes for each element, and linking them in a doubly linked list fashion. One can use any preferred programming language and follow a step-by-step algorithm to achieve this conversion.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Constructing a doubly linked list from a 2D matrix is a fascinating exercise that involves transforming a two-dimensional data structure into a linked list, specifically a doubly linked list. This process requires traversing through the matrix elements, creating nodes, and linking them in such a way that they form a linked list where each node [&hellip;]<\/p>\n","protected":false},"author":3,"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-4676","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>Construct A Doubly Linked List From 2D Matrix<\/title>\n<meta name=\"description\" content=\"Given a 2D Matrix, construct a doubly linked list using it. This blog discuss the problem when we are given a 2D matrix\" \/>\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\/construct-a-doubly-linked-list-from-2d-matrix\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Construct A Doubly Linked List From 2D Matrix\" \/>\n<meta property=\"og:description\" content=\"Given a 2D Matrix, construct a doubly linked list using it. This blog discuss the problem when we are given a 2D matrix\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/\" \/>\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-02T09:16:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-27T12:43:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Construct-A-Doubly-Linked-List-From-2D-Matrix.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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/\"},\"author\":{\"name\":\"PrepBytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/39fcf072e04987f16796546f2ca83c2e\"},\"headline\":\"Construct A Doubly Linked List From 2D Matrix\",\"datePublished\":\"2021-09-02T09:16:36+00:00\",\"dateModified\":\"2023-11-27T12:43:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/\"},\"wordCount\":856,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Construct-A-Doubly-Linked-List-From-2D-Matrix.png\",\"articleSection\":[\"Linked list articles\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/\",\"name\":\"Construct A Doubly Linked List From 2D Matrix\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Construct-A-Doubly-Linked-List-From-2D-Matrix.png\",\"datePublished\":\"2021-09-02T09:16:36+00:00\",\"dateModified\":\"2023-11-27T12:43:52+00:00\",\"description\":\"Given a 2D Matrix, construct a doubly linked list using it. This blog discuss the problem when we are given a 2D matrix\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#primaryimage\",\"url\":\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Construct-A-Doubly-Linked-List-From-2D-Matrix.png\",\"contentUrl\":\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Construct-A-Doubly-Linked-List-From-2D-Matrix.png\",\"width\":595,\"height\":450},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#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\":\"Construct A Doubly Linked List From 2D Matrix\"}]},{\"@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\/39fcf072e04987f16796546f2ca83c2e\",\"name\":\"PrepBytes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/850669d326db1e1531f04db0c63145d941c2a26792aaeee226a9e6675b0ac698?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/850669d326db1e1531f04db0c63145d941c2a26792aaeee226a9e6675b0ac698?s=96&d=mm&r=g\",\"caption\":\"PrepBytes\"},\"url\":\"https:\/\/prepbytes.com\/blog\/author\/prepbytes\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Construct A Doubly Linked List From 2D Matrix","description":"Given a 2D Matrix, construct a doubly linked list using it. This blog discuss the problem when we are given a 2D matrix","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\/construct-a-doubly-linked-list-from-2d-matrix\/","og_locale":"en_US","og_type":"article","og_title":"Construct A Doubly Linked List From 2D Matrix","og_description":"Given a 2D Matrix, construct a doubly linked list using it. This blog discuss the problem when we are given a 2D matrix","og_url":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2021-09-02T09:16:36+00:00","article_modified_time":"2023-11-27T12:43:52+00:00","og_image":[{"url":"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Construct-A-Doubly-Linked-List-From-2D-Matrix.png","type":"","width":"","height":""}],"author":"PrepBytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"PrepBytes","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/"},"author":{"name":"PrepBytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/39fcf072e04987f16796546f2ca83c2e"},"headline":"Construct A Doubly Linked List From 2D Matrix","datePublished":"2021-09-02T09:16:36+00:00","dateModified":"2023-11-27T12:43:52+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/"},"wordCount":856,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Construct-A-Doubly-Linked-List-From-2D-Matrix.png","articleSection":["Linked list articles"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/","url":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/","name":"Construct A Doubly Linked List From 2D Matrix","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Construct-A-Doubly-Linked-List-From-2D-Matrix.png","datePublished":"2021-09-02T09:16:36+00:00","dateModified":"2023-11-27T12:43:52+00:00","description":"Given a 2D Matrix, construct a doubly linked list using it. This blog discuss the problem when we are given a 2D matrix","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#primaryimage","url":"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Construct-A-Doubly-Linked-List-From-2D-Matrix.png","contentUrl":"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/09\/Construct-A-Doubly-Linked-List-From-2D-Matrix.png","width":595,"height":450},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/construct-a-doubly-linked-list-from-2d-matrix\/#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":"Construct A Doubly Linked List From 2D Matrix"}]},{"@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\/39fcf072e04987f16796546f2ca83c2e","name":"PrepBytes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/850669d326db1e1531f04db0c63145d941c2a26792aaeee226a9e6675b0ac698?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/850669d326db1e1531f04db0c63145d941c2a26792aaeee226a9e6675b0ac698?s=96&d=mm&r=g","caption":"PrepBytes"},"url":"https:\/\/prepbytes.com\/blog\/author\/prepbytes\/"}]}},"_links":{"self":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/4676","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\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/comments?post=4676"}],"version-history":[{"count":8,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/4676\/revisions"}],"predecessor-version":[{"id":18391,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/4676\/revisions\/18391"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=4676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=4676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=4676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}