{"id":694,"date":"2025-07-18T15:01:16","date_gmt":"2025-07-18T09:31:16","guid":{"rendered":"https:\/\/codeanddebug.in\/blog\/?p=694"},"modified":"2025-07-18T15:01:17","modified_gmt":"2025-07-18T09:31:17","slug":"reverse-a-doubly-linked-list","status":"publish","type":"post","link":"https:\/\/codeanddebug.in\/blog\/reverse-a-doubly-linked-list\/","title":{"rendered":"Reverse a Doubly Linked List | GFG Practice | Iterative Solution"},"content":{"rendered":"\n<p>Given a&nbsp;<strong>doubly linked list<\/strong>. Your task is to&nbsp;<strong>reverse&nbsp;<\/strong>the doubly linked list and return its head.<\/p>\n\n\n\n<p>Here&#8217;s the [<strong><a href=\"https:\/\/www.geeksforgeeks.org\/problems\/reverse-a-doubly-linked-list\/1\" target=\"_blank\" rel=\"noreferrer noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\"><span style=\"text-decoration: underline;\">Problem Link<\/span><\/mark><\/a><\/strong>] to begin with.<\/p>\n\n\n\n<p><strong>Examples:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Input: <\/strong>LinkedList: 3 &lt;-&gt; 4 &lt;-&gt; 5\n<strong>Output: <\/strong>5 &lt;-&gt; 4 &lt;-&gt; 3<br><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/media.geeksforgeeks.org\/img-practice\/prod\/addEditProblem\/700137\/Web\/Other\/blobid1_1724317926.png\" width=\"331\" height=\"198\"><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Input: <\/strong>LinkedList: 75 &lt;-&gt; 122 &lt;-&gt; 59 &lt;-&gt; 196\n<strong>Output: <\/strong>196 &lt;-&gt; 59 &lt;-&gt; 122 &lt;-&gt; 75<br><img decoding=\"async\" src=\"https:\/\/media.geeksforgeeks.org\/img-practice\/prod\/addEditProblem\/700137\/Web\/Other\/blobid0_1724317913.png\" width=\"392\" height=\"235\"><\/pre>\n\n\n\n<p><strong>Expected Time Complexity:&nbsp;<\/strong>O(n).<br><strong>Expected Auxiliary Space:&nbsp;<\/strong>O(1).<\/p>\n\n\n\n<p><strong>Constraints:<\/strong><br>1 &lt;= number of nodes &lt;= 10<sup>6<\/sup><br>0 &lt;= node-&gt;data &lt;= 10<sup>4<\/sup><\/p>\n\n\n<div style=\"max-width: -moz-fit-content; \" class=\"wp-block-ub-table-of-contents-block ub_table-of-contents ub_table-of-contents-collapsed\" id=\"ub_table-of-contents-ccdb03b3-238a-4306-987f-f13328c69dc3\" data-linktodivider=\"false\" data-showtext=\"show\" data-hidetext=\"hide\" data-scrolltype=\"auto\" data-enablesmoothscroll=\"true\" data-initiallyhideonmobile=\"true\" data-initiallyshow=\"false\"><div class=\"ub_table-of-contents-header-container\" style=\"\">\n\t\t\t<div class=\"ub_table-of-contents-header\" style=\"text-align: left; \">\n\t\t\t\t<div class=\"ub_table-of-contents-title\">Contents:<\/div>\n\t\t\t\t<div class=\"ub_table-of-contents-header-toggle\">\n\t\t\t<div class=\"ub_table-of-contents-toggle\" style=\"\">\n\t\t\t\u00a0[<a class=\"ub_table-of-contents-toggle-link\" href=\"#\" style=\"\">show<\/a>]\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div><div class=\"ub_table-of-contents-extra-container\" style=\"\">\n\t\t\t<div class=\"ub_table-of-contents-container ub_table-of-contents-1-column ub-hide\">\n\t\t\t\t<ul style=\"\"><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/reverse-a-doubly-linked-list\/#0-solution-optimal-approach-swap-pointers\" style=\"\">Solution: Optimal Approach (Swap Pointers)<\/a><ul><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/reverse-a-doubly-linked-list\/#1-intuition\" style=\"\">Intuition<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/reverse-a-doubly-linked-list\/#2-detailed-approach\" style=\"\">Detailed Approach<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/reverse-a-doubly-linked-list\/#3-code\" style=\"\">Code<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/reverse-a-doubly-linked-list\/#4-code-explanation\" style=\"\">Code Explanation<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/reverse-a-doubly-linked-list\/#5-dry-run\" style=\"\">Dry Run<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/reverse-a-doubly-linked-list\/#6-time-and-space-complexity\" style=\"\">Time and Space Complexity<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/reverse-a-doubly-linked-list\/#7-simplifying-it\" style=\"\">Simplifying It<\/a><\/li><\/ul><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/reverse-a-doubly-linked-list\/#8-key-insights\" style=\"\">Key Insights<\/a><\/li><li style=\"\"><a href=\"https:\/\/codeanddebug.in\/blog\/reverse-a-doubly-linked-list\/#9-summary\" style=\"\">Summary<\/a><\/li><\/ul>\n\t\t\t<\/div>\n\t\t<\/div><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"0-solution-optimal-approach-swap-pointers\">Solution: Optimal Approach (Swap Pointers)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-intuition\">Intuition<\/h3>\n\n\n\n<p>Think of this like rearranging a train where each car is connected to both the car in front and behind it! To reverse the train&#8217;s direction, you need to swap the connections of each car &#8211; what used to be the &#8220;front&#8221; connection becomes the &#8220;back&#8221; connection, and vice versa. The key insight is that we don&#8217;t need to move the actual cars (nodes) &#8211; we just need to swap their connection directions. It&#8217;s like telling each car &#8220;your front is now your back, and your back is now your front!&#8221;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-detailed-approach\">Detailed Approach<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Handle Edge Cases<\/strong>: If the list is empty or has only one node, return it as is<\/li>\n\n\n\n<li><strong>Initialize Pointers<\/strong>: Set up current pointer to traverse and new_head to track the new head<\/li>\n\n\n\n<li><strong>Traverse and Swap<\/strong>: For each node, swap its prev and next pointers<\/li>\n\n\n\n<li><strong>Track New Head<\/strong>: Keep updating new_head to the current node (which will become the new head)<\/li>\n\n\n\n<li><strong>Move to Next<\/strong>: Move to the next node (which is actually the previous node after swapping)<\/li>\n\n\n\n<li><strong>Return New Head<\/strong>: The last node we processed becomes the new head<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-code\">Code<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"class Solution:\n    def reverseDLL(self, head):\n        # Handle edge cases: empty list or single node\n        if not head or not head.next:\n            return head\n\n        current = head      # Pointer to traverse through the list\n        new_head = None     # Will store the new head after reversal\n\n        # Traverse each node and swap prev and next pointers\n        while current:\n            # Store current.prev temporarily before swapping\n            temp = current.prev\n            \n            # Swap the pointers: prev becomes next, next becomes prev\n            current.prev = current.next\n            current.next = temp\n\n            # Update new_head to current node (last processed becomes new head)\n            new_head = current\n\n            # Move to the &quot;next&quot; node (which is actually current.prev after swap)\n            current = current.prev\n\n        return new_head\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Solution<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">def<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">reverseDLL<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">self<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">head<\/span><span style=\"color: #D4D4D4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #6A9955\"># Handle edge cases: empty list or single node<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">not<\/span><span style=\"color: #D4D4D4\"> head <\/span><span style=\"color: #569CD6\">or<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">not<\/span><span style=\"color: #D4D4D4\"> head.next:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> head<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        current = head      <\/span><span style=\"color: #6A9955\"># Pointer to traverse through the list<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        new_head = <\/span><span style=\"color: #569CD6\">None<\/span><span style=\"color: #D4D4D4\">     <\/span><span style=\"color: #6A9955\"># Will store the new head after reversal<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #6A9955\"># Traverse each node and swap prev and next pointers<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">while<\/span><span style=\"color: #D4D4D4\"> current:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #6A9955\"># Store current.prev temporarily before swapping<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            temp = current.prev<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #6A9955\"># Swap the pointers: prev becomes next, next becomes prev<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            current.prev = current.next<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            current.next = temp<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #6A9955\"># Update new_head to current node (last processed becomes new head)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            new_head = current<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #6A9955\"># Move to the &quot;next&quot; node (which is actually current.prev after swap)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            current = current.prev<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> new_head<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative\">Python<\/span><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4-code-explanation\">Code Explanation<\/h3>\n\n\n\n<p>This solution works by swapping the prev and next pointers of each node in the doubly linked list. We traverse through the list and for each node, we swap its connections so that what used to point forward now points backward, and vice versa. The clever part is that after swapping, we need to move to&nbsp;<code>current.prev<\/code>&nbsp;instead of&nbsp;<code>current.next<\/code>&nbsp;because the connections have been flipped. We keep track of the new head by updating it to each node we process &#8211; the last node we process will be the original tail, which becomes the new head.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"5-dry-run\">Dry Run<\/h3>\n\n\n\n<p>Let&#8217;s trace through:&nbsp;<code>1 &lt;-&gt; 2 &lt;-&gt; 3 &lt;-&gt; 4<\/code><\/p>\n\n\n\n<p><strong>Initial Setup:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>current = 1, new_head = None<\/li>\n\n\n\n<li>Original:\u00a0<code>1 &lt;-> 2 &lt;-> 3 &lt;-> 4<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>Step 1: Process Node 1<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>temp = None (1&#8217;s prev)<\/li>\n\n\n\n<li>Swap: 1.prev = 2, 1.next = None<\/li>\n\n\n\n<li>new_head = 1<\/li>\n\n\n\n<li>current = 1.prev = 2<\/li>\n\n\n\n<li>State:\u00a0<code>None &lt;- 1 2 &lt;-> 3 &lt;-> 4<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>Step 2: Process Node 2<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>temp = 1 (2&#8217;s prev)<\/li>\n\n\n\n<li>Swap: 2.prev = 3, 2.next = 1<\/li>\n\n\n\n<li>new_head = 2<\/li>\n\n\n\n<li>current = 2.prev = 3<\/li>\n\n\n\n<li>State:\u00a0<code>None &lt;- 1 &lt;- 2 3 &lt;-> 4<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>Step 3: Process Node 3<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>temp = 2 (3&#8217;s prev)<\/li>\n\n\n\n<li>Swap: 3.prev = 4, 3.next = 2<\/li>\n\n\n\n<li>new_head = 3<\/li>\n\n\n\n<li>current = 3.prev = 4<\/li>\n\n\n\n<li>State:\u00a0<code>None &lt;- 1 &lt;- 2 &lt;- 3 4<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>Step 4: Process Node 4<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>temp = 3 (4&#8217;s prev)<\/li>\n\n\n\n<li>Swap: 4.prev = None, 4.next = 3<\/li>\n\n\n\n<li>new_head = 4<\/li>\n\n\n\n<li>current = 4.prev = None<\/li>\n\n\n\n<li>State:\u00a0<code>None &lt;- 1 &lt;- 2 &lt;- 3 &lt;- 4<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>Final Result:<\/strong>&nbsp;<code>4 &lt;-&gt; 3 &lt;-&gt; 2 &lt;-&gt; 1<\/code>&nbsp;with new_head = 4<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"6-time-and-space-complexity\">Time and Space Complexity<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Time Complexity:<\/strong>\u00a0O(n) &#8211; We visit each node exactly once during traversal<\/li>\n\n\n\n<li><strong>Space Complexity:<\/strong>\u00a0O(1) &#8211; We only use a few pointer variables, no extra space needed<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"7-simplifying-it\">Simplifying It<\/h3>\n\n\n\n<p>This approach is like rearranging a chain of people holding hands where everyone can hold both the hand in front and behind them. To reverse the direction, you tell each person &#8220;switch hands&#8221; &#8211; whoever was on your left is now on your right, and vice versa. You don&#8217;t need to physically move anyone, just change who they&#8217;re holding hands with. The person who was at the end of the line naturally becomes the new leader!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"8-key-insights\">Key Insights<\/h2>\n\n\n\n<p><strong>Why we swap pointers instead of values:<\/strong><br>Swapping pointers is more efficient than swapping values because we only need to change references, not copy actual data. This works regardless of how large the data in each node is.<\/p>\n\n\n\n<p><strong>Why we move to current.prev after swapping:<\/strong><br>After swapping the pointers, the &#8220;next&#8221; node in our original direction is now accessible through the prev pointer. It&#8217;s like the directions got flipped!<\/p>\n\n\n\n<p><strong>Why we track new_head:<\/strong><br>Since we&#8217;re changing the direction of the entire list, the original tail becomes the new head. We keep updating new_head so we know which node to return.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"9-summary\">Summary<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Approach<\/th><th>Time<\/th><th>Space<\/th><th>Difficulty<\/th><th>Best For<\/th><\/tr><\/thead><tbody><tr><td>Swap Pointers<\/td><td>O(n)<\/td><td>O(1)<\/td><td>Medium<\/td><td>Production code<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>This&nbsp;<strong>optimal solution<\/strong>&nbsp;efficiently reverses the doubly linked list in a single pass using constant extra space. The key insight is that we don&#8217;t need to move nodes around &#8211; we just need to swap their connection directions.<\/p>\n\n\n\n<p>This problem beautifully demonstrates the power of pointer manipulation in doubly linked lists. The bidirectional nature of doubly linked lists makes reversal elegant because we can simply swap the direction of each connection. It&#8217;s a fundamental operation that appears in many advanced algorithms and data structure problems!<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-16018d1d wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codeanddebug.in\/course\/zero-to-hero-python-dsa\" target=\"_blank\" rel=\"noreferrer noopener\">Join our Advance DSA COURSE<\/a><\/div>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><em>For any changes to the article, kindly email at <a href=\"mailto:code@codeanddebug.in\" target=\"_blank\" rel=\"noreferrer noopener\">code@codeanddebug.in<\/a> or contact us at <a href=\"tel:+91-9712928220\" target=\"_blank\" rel=\"noreferrer noopener\">+91-9712928220<\/a>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Given a&nbsp;doubly linked list. Your task is to&nbsp;reverse&nbsp;the doubly linked list and return its head. Here&#8217;s the [Problem Link] to begin with. Examples: Input: LinkedList: 3 &lt;-&gt; 4 &lt;-&gt; 5 Output: 5 &lt;-&gt; 4 &lt;-&gt; 3 Input: LinkedList: 75 &lt;-&gt; 122 &lt;-&gt; 59 &lt;-&gt; 196 Output: 196 &lt;-&gt; 59 &lt;-&gt; 122 &lt;-&gt; 75 Expected Time<\/p>\n","protected":false},"author":1,"featured_media":695,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[30,8],"class_list":{"0":"post-694","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-structures-and-algorithm","8":"category-beginner","9":"tag-doubly-linked-list","10":"tag-easy"},"featured_image_src":"https:\/\/codeanddebug.in\/blog\/wp-content\/uploads\/2025\/07\/reverse-a-doubly-linked-list-featured-image.png","author_info":{"display_name":"codeanddebug","author_link":"https:\/\/codeanddebug.in\/blog\/author\/codeanddebug\/"},"_links":{"self":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/694","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/comments?post=694"}],"version-history":[{"count":2,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/694\/revisions"}],"predecessor-version":[{"id":698,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/posts\/694\/revisions\/698"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/media\/695"}],"wp:attachment":[{"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/media?parent=694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/categories?post=694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeanddebug.in\/blog\/wp-json\/wp\/v2\/tags?post=694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}