{"id":4208,"date":"2021-08-24T01:53:05","date_gmt":"2021-08-24T01:53:05","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=4208"},"modified":"2023-11-28T05:12:24","modified_gmt":"2023-11-28T05:12:24","slug":"partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/","title":{"rendered":"Partitioning a linked list around a given value and keeping the original order"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644922083555-88.Partitioning-a-linked-list_Artboard%201.png\" alt=\"\" \/><\/p>\n<p>Embarking on the journey of partitioning a linked list around a given value while preserving the original order is a compelling exploration into the realm of linked list manipulation. This task involves rearranging the elements of a linked list so that all nodes with values less than a specified value appear before those greater than or equal to it, all while maintaining the initial order of elements. In this guide, we will unravel the intricacies of this operation, exploring algorithms and techniques to seamlessly partition a linked list around a chosen value while respecting the original order. Let&#8217;s dive into the fascinating world of linked list manipulation and partitioning!<\/p>\n<h2>Partitioning a linked list around a given value <\/h2>\n<p>In this problem, given a linked list and a value X, we are required to partition it such that all nodes less than X come before nodes greater than or equal to x. <\/p>\n<p><strong>Note:<\/strong> You should maintain the original relative order of the nodes in each of the two partitions.<\/p>\n<p>Let\u2019s understand the problem statement with the help of examples.<\/p>\n<p>If the given linked list is:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/08\/input-10.png\" alt=\"\" \/><\/p>\n<p>It means that we have to move all nodes smaller than 3 before the nodes have values greater than or equal to 3. Also, while partitioning the linked list around value 3,  the original relative order of the nodes in each of the two partitions should be maintained.<\/p>\n<p>So our final resultant linked list after partitioning will look like this:<br \/>\n<img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/08\/output-4.png\" alt=\"\" \/><\/p>\n<p>This statement <strong>maintains the original relative order of the nodes in each of the two partitions<\/strong> implies that while partitioning, the nodes in each of the two partitions should be in the same order as they are present in the original linked list.<\/p>\n<ul>\n<li>From the above-linked list, we can see that 1, 2, and 2 will come in the first partition(nodes smaller than X) and 4, 3, and 7 will come in the second partition(nodes greater than or equal to X).<\/li>\n<li>If we carefully compare the resultant linked list and the original linked list we can clearly see that 1, 2, and 2, the nodes of the first partition are in the same order in the resultant list as they were in the original linked list (2 is occurring after 1 and another 2 is occurring after 2). Similarly, the nodes of the second partition 4, 3, and 7 are also in the same order as they were in the original linked list (3 is occurring after 4 and another 5 is occurring after 3).<\/li>\n<\/ul>\n<p><strong>Explanation:<\/strong> In the resultant linked list, first there will be the elements of the first partition (elements or nodes smaller than X) and then there will be the elements of the second partition (elements greater than or equal to X). Also, both partitions will preserve the order from the original linked list.<\/p>\n<p>Now I think from the above example the problem is clear, we will have to now think of how we can approach this problem.<\/p>\n<h2>Approach to partition a linked list around a given value <\/h2>\n<p>As we need all the nodes having a value smaller than X before nodes having a value greater than or equal to X, so we will have to divide the original linked list into two sections: <\/p>\n<ul>\n<li>A list of nodes with values less than X and,<\/li>\n<li>A list of nodes with values higher than or equal to X. <\/li>\n<\/ul>\n<p>Then, after diving into the original linked list, we&#8217;ll use pointers to stitch them back together after the division such that all the nodes having smaller value than X comes before nodes having a greater value equal to X.<\/p>\n<p><strong>The algorithm in brief:<\/strong><\/p>\n<p>We will traverse the original linked list as normal, and we will select in which linked list a node should belong to based on its value. <\/p>\n<ul>\n<li>If a node&#8217;s value is less than X, it will be appended to the <strong>low-container list<\/strong>, which keeps track of nodes with values less than X.<\/li>\n<li>Otherwise, it will be appended to the <strong>high-container list<\/strong>, which keeps track of nodes with values greater than or equal to X.<\/li>\n<\/ul>\n<p>Finally, after traversing, we&#8217;ll sew the end node of the first linked list (the <strong>low-container list<\/strong>) to the head node of our second list (the <strong>high-container list<\/strong>). This way, we can maintain the order of elements in the list.<\/p>\n<p>After the complete traversal of the original linked list, the <strong>low-container<\/strong> list will have all the nodes having value smaller than X, while the <strong>high-container<\/strong> list will have all the nodes having values greater than or equal to X.<\/p>\n<p>A few buffers will be required to maintain track of the partitioned lists.<\/p>\n<ul>\n<li><strong>new_Head:<\/strong> Head of the new modified linked list.<\/li>\n<li><strong>low_Head:<\/strong> Head of low-container linked list.<\/li>\n<li><strong>high_Head:<\/strong> Head of high-container linked list.<\/li>\n<li><strong>less:<\/strong> A pointer that will help us in linking every node with the value lower than X together, this way we will get the low-container list. It will act as an iterator for the low-container linked list.<\/li>\n<li><strong>more:<\/strong> A pointer which will help us in linking every node with the value higher or equal to the X together, this way we will get the high-container list. It will act as an iterator for the high-container linked list.<\/li>\n<\/ul>\n<h2>Algorithm to partition a linked list around a given value <\/h2>\n<ul>\n<li>Check if <strong>head == NULL<\/strong>, If true, return NULL.<\/li>\n<li>Initialize <strong>new_Head<\/strong>, <strong>low_Head<\/strong>, <strong>high_Head<\/strong>, <strong>less<\/strong> and <strong>more<\/strong> to NULL.<\/li>\n<li>Begin iterating the original linked list. We&#8217;ll try to make two distinct linked lists (<strong>low-container list<\/strong> and <strong>high-container list<\/strong>) out of the original linked list by just changing the links.<\/li>\n<li>While traversing the original linked list:\n<ul>\n<li>If a node is having value smaller than X, it will get appended to the end of <strong>low-container list<\/strong>.<\/li>\n<li>If a node is having value greater than or equal to X, it will get appended to the end of <strong>high-container list<\/strong>.<\/li>\n<\/ul>\n<\/li>\n<li>Once the traversal of the original linked list is over, the <strong>low-container list<\/strong> will be a list having all the nodes with values smaller than X and the <strong>high-container list<\/strong> will contain all the nodes from the original list having values greater than or equal to X.<\/li>\n<li>The heads of the two linked lists above will both point to the first node of their own lists.<\/li>\n<li>Finally, all that remains is to stitch the lists back together. The <strong>low-container linked list&#8217;s<\/strong> last node should point to the head of the <strong>high-container linked list<\/strong>. <\/li>\n<li>We will return the head of <strong>high-container list<\/strong> if the <strong>low-container list<\/strong> does not exist (the original linked list does not contains any nodes with a value less than X) and if the <strong>low-container list<\/strong> exists we will make <strong>new_Head<\/strong> point to head of <strong>low-container<\/strong>(<strong>low_Head<\/strong>) and will return <strong>new_Head<\/strong>.<\/li>\n<\/ul>\n<p>The problem has been solved only by adjusting the links.<\/p>\n<h3>Dry Run of partition a linked list around a given value <\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/08\/Partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order-1.png\" alt=\"\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/08\/Partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order-2.png\" alt=\"\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/08\/Partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order-3.png\" alt=\"\" \/><\/p>\n<p>## Code Implementation of partition a linked list around a given value<\/p>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_4209 {\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_4209 .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_4209 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_4209 .wpsm_nav-tabs > li.active > a, #tab_container_4209 .wpsm_nav-tabs > li.active > a:hover, #tab_container_4209 .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_4209 .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_4209 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_4209 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_4209 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_4209 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_4209 .wpsm_nav-tabs > li > a:hover , #tab_container_4209 .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_4209 .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_4209 .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_4209 .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_4209 .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_4209 .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_4209 .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_4209 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_4209 .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_4209 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_4209 .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_4209 .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_4209\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_4209\">\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_4209_1\" aria-controls=\"tabs_desc_4209_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\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_4209_2\" aria-controls=\"tabs_desc_4209_2\" 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\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_4209_3\" aria-controls=\"tabs_desc_4209_3\" 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>Java<\/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\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_4209_4\" aria-controls=\"tabs_desc_4209_4\" 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>Python<\/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_4209\">\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_4209_1\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"c\"} -->\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" 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\/\/ Structure of a node\r\nstruct node{\r\n    int val;\r\n    struct node* next;\r\n    node(int x){\r\n        val=x;\r\n        next=NULL;\r\n    }\r\n};\r\n\r\n\r\n\/\/ Return pointer to the produced list.\r\nstruct node* orderOfList(struct node* head,int x){\r\n    if(!head)return head;  \r\n\/\/ return NULL if the linked list is empty\r\n    \r\n\/\/ Head of the modified list\r\n    struct node* new_Head = NULL; \r\n\/\/ Head of low-container list partition\r\n    struct node* low_Head = NULL;   \r\n\/\/ Head of high-container list partition\r\n    struct node* high_Head = NULL; \r\n\/\/ Itearator of low-container list. \r\n    struct node* less = NULL;  \r\n\/\/  Iterator of high-container list.    \r\n    struct node* more = NULL;    \r\n             \r\n\/\/ traverse through the list.\r\n    while(head){            \r\n        if(head->val < x){          \r\n\/* If the node's value is less than x,\r\nit should go in low-container.\r\n              \r\nIf we haven't set the head of low-container\r\nThen, low_Head will be the head.*\/\r\n            if(!low_Head){          \r\n                low_Head = head;     \r\n\/\/ and also point the iterator to the beginning.\r\n                less = low_Head;         \r\n            }else{\r\n                less->next = head;   \r\n\/* If the low_Head is already initialized, we are required to point the iterator to point to this node*\/\r\n                less = head;     \r\n            }\r\n            \r\n        }else{\r\n        \r\n            if(!high_Head){           \r\n\/* initialize if the head of the high-container has not been initialized yet.  \r\nand point the 'more' iterator to the beginning\r\nwhich is high_Head.*\/\r\n                high_Head = head;\r\n                more = high_Head;  \r\n            }else{ \r\n\/* If high_Head already initialized,\r\npoint the next field of last node in this list to head*\/\r\n                more->next = head; \r\n\/\/ updating the iterator\r\n                more = head;\r\n            }\r\n        }\r\n        head = head->next; \r\n\/\/ Update the iterator of the original list.\r\n    }\r\n    if(low_Head == NULL){ \r\n\/* If the first partition of the linked list(low-container) is empty, we just return the high_Head.\r\n Also point the last node's next to NULL.*\/\r\n        new_Head = high_Head;\r\n        more->next = NULL;  \r\n    }else{ \r\n\/* if the low_head list exists\r\npoint the new_Head to low_Head*\/\r\n        new_Head = low_Head; \r\n\/* last node of the low-container should\r\npoint to the high-container's head.*\/\r\n        less->next = high_Head; \r\n        if(high_Head){         \r\n            more->next = NULL;\r\n        }\r\n    }\r\n    return new_Head;   \r\n}\r\n\r\n\/\/ To traverse through the linked list\r\nvoid list_traversal(struct node* head){\r\n    while(head){                       \r\n        cout<<head->val<<\" \";\r\n        head = head->next;\r\n    }\r\n}\r\nint main() {\r\n    \r\n    struct node* head = new node(1);\r\n    head->next = new node(4);\r\n    head->next->next = new node(3);\r\n    head->next->next->next = new node(2);\r\n    head->next->next->next->next = new node(7);\r\n    head->next->next->next->next->next = new node(2);\r\n    int x = 3; \r\n    \r\n    struct node* new_Head = orderOfList(head,x);\r\n    list_traversal(new_Head);\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\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane \" id=\"tabs_desc_4209_2\">\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\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane \" id=\"tabs_desc_4209_3\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"Java\"} -->\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"Java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\r\n\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane \" id=\"tabs_desc_4209_4\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"Python\"} -->\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"Python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\r\n\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\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_4209 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_4209 a\"),jQuery(\"#tab-content_4209\"));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>    Output<br \/>\n    1\u21922\u21922\u21924\u21923\u21927<\/p>\n<p><strong>Time Complexity of partition a linked list around a given value:<\/strong> O(N) \u2013 we are traversing through the original linked list and only creating 2 linked lists out of it.<\/p>\n<p>**Conclusion**<br \/>\nIn conclusion, the process of partitioning a linked list around a given value while preserving the original order is a nuanced operation that combines principles of sorting and linked list manipulation. By carefully traversing the list and reorganizing nodes based on the specified value, the original order is maintained while achieving the desired partition. This task not only calls for a clear understanding of pointers and node manipulation but also highlights the elegance of algorithms in maintaining order within a linked list. As you delve into linked list partitioning, you unlock a powerful skill for efficient data organization in programming.<\/p>\n<p>## FAQs related to partition a linked list around a given value<br \/>\nBelow are some of the FAQs related tp Partition a Linked List around a given value:<\/p>\n<p>**Q1: Why would I need to partition a linked list around a given value while preserving the original order?<br \/>\nA1:** Partitioning a linked list around a given value while preserving the original order is often necessary when you want to organize the elements based on a specific criterion without altering their initial sequence. This can be crucial for certain algorithms or data processing tasks.<\/p>\n<p>**Q2: Are there specific algorithms or methods for partitioning a linked list around a given value?<br \/>\nA2:** Yes, there are various algorithms and approaches for partitioning a linked list around a given value while preserving the original order. One common method involves iterating through the list, comparing values, and appropriately reorganizing nodes to achieve the desired partition.<\/p>\n<p>**Q3: How does the time complexity of partitioning a linked list compare to sorting it?<br \/>\nA3:** The time complexity of partitioning a linked list around a given value while preserving the original order can vary depending on the algorithm used. In general, it is likely to be more efficient than a full sorting operation, especially if the original order needs to be maintained.<\/p>\n<p>**Q4: Can partitioning a linked list be performed in-place, or does it require additional data structures?<br \/>\nA4:** Partitioning a linked list can be performed in-place, meaning that the rearrangement of nodes is done within the existing list without requiring additional data structures. This is often achieved through careful manipulation of pointers.<\/p>\n<p>**Q5: What happens if the given value in partitioning is not present in the linked list?<br \/>\nA5:** If the given value is not present in the linked list, the partitioning operation may proceed as usual, with elements less than the specified value appearing before those greater than or equal to it. The absence of the value does not typically disrupt the partitioning process.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Embarking on the journey of partitioning a linked list around a given value while preserving the original order is a compelling exploration into the realm of linked list manipulation. This task involves rearranging the elements of a linked list so that all nodes with values less than a specified value appear before those greater than [&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-4208","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>Partitioning a linked list around a given value and keeping the original order<\/title>\n<meta name=\"description\" content=\"Learn the most efficient way to partition a linked list around a given value and keep the original order.\" \/>\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\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Partitioning a linked list around a given value and keeping the original order\" \/>\n<meta property=\"og:description\" content=\"Learn the most efficient way to partition a linked list around a given value and keep the original order.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/\" \/>\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-08-24T01:53:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-28T05:12:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644922083555-88.Partitioning-a-linked-list_Artboard%201.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=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/\"},\"author\":{\"name\":\"PrepBytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/39fcf072e04987f16796546f2ca83c2e\"},\"headline\":\"Partitioning a linked list around a given value and keeping the original order\",\"datePublished\":\"2021-08-24T01:53:05+00:00\",\"dateModified\":\"2023-11-28T05:12:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/\"},\"wordCount\":1613,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644922083555-88.Partitioning-a-linked-list_Artboard%201.png\",\"articleSection\":[\"Linked list articles\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/\",\"name\":\"Partitioning a linked list around a given value and keeping the original order\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644922083555-88.Partitioning-a-linked-list_Artboard%201.png\",\"datePublished\":\"2021-08-24T01:53:05+00:00\",\"dateModified\":\"2023-11-28T05:12:24+00:00\",\"description\":\"Learn the most efficient way to partition a linked list around a given value and keep the original order.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644922083555-88.Partitioning-a-linked-list_Artboard%201.png\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644922083555-88.Partitioning-a-linked-list_Artboard%201.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#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\":\"Partitioning a linked list around a given value and keeping the original order\"}]},{\"@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":"Partitioning a linked list around a given value and keeping the original order","description":"Learn the most efficient way to partition a linked list around a given value and keep the original order.","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\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/","og_locale":"en_US","og_type":"article","og_title":"Partitioning a linked list around a given value and keeping the original order","og_description":"Learn the most efficient way to partition a linked list around a given value and keep the original order.","og_url":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2021-08-24T01:53:05+00:00","article_modified_time":"2023-11-28T05:12:24+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644922083555-88.Partitioning-a-linked-list_Artboard%201.png","type":"","width":"","height":""}],"author":"PrepBytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"PrepBytes","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/"},"author":{"name":"PrepBytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/39fcf072e04987f16796546f2ca83c2e"},"headline":"Partitioning a linked list around a given value and keeping the original order","datePublished":"2021-08-24T01:53:05+00:00","dateModified":"2023-11-28T05:12:24+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/"},"wordCount":1613,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644922083555-88.Partitioning-a-linked-list_Artboard%201.png","articleSection":["Linked list articles"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/","url":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/","name":"Partitioning a linked list around a given value and keeping the original order","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644922083555-88.Partitioning-a-linked-list_Artboard%201.png","datePublished":"2021-08-24T01:53:05+00:00","dateModified":"2023-11-28T05:12:24+00:00","description":"Learn the most efficient way to partition a linked list around a given value and keep the original order.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644922083555-88.Partitioning-a-linked-list_Artboard%201.png","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644922083555-88.Partitioning-a-linked-list_Artboard%201.png"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/partitioning-a-linked-list-around-a-given-value-and-keeping-the-original-order\/#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":"Partitioning a linked list around a given value and keeping the original order"}]},{"@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\/4208","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=4208"}],"version-history":[{"count":9,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/4208\/revisions"}],"predecessor-version":[{"id":18402,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/4208\/revisions\/18402"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=4208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=4208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=4208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}