{"id":5118,"date":"2021-10-11T08:21:10","date_gmt":"2021-10-11T08:21:10","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=5118"},"modified":"2022-11-30T05:14:05","modified_gmt":"2022-11-30T05:14:05","slug":"point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/","title":{"rendered":"Point arbit pointer to greatest value right-side node in a linked list"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645011497773-Article_184.png\" alt=\"\" \/><\/p>\n<p>In this article, we will discuss one of the famous questions of linked lists \u201cPoint arbit pointer to greatest value right-side node in a linked list\u201d. Having practice questions like \u201cPoint arbit pointer to greatest value right-side node in a linked list\u201d will make your data structures like linked list strong. Now let\u2019s go to our topic \u201cPoint arbit pointer to greatest value right-side node in a linked list\u201d to understand it in detail.<\/p>\n<h2>How to point arbit pointer to greatest value right-side node in a linked list<\/h2>\n<p>Given a linked list in which each node will have an extra arbitrary pointer pointing to NULL initially. We need to make that arbitrary pointer point to the greatest valued node on the right side of that node.<\/p>\n<p>The problem statement is quite straightforward; we will be given a singly linked list in which, apart from the next pointer, we will also have an arbit pointer which will be NULL initially, and we need to make that arbit pointer point to the greatest value in the right part of the list.<\/p>\n<p>Let&#8217;s try to understand the problem with the help of examples.<br \/>\nLet the input given to us be:<br \/>\n<img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/10\/p_1-6.png\" alt=\"\" \/><\/p>\n<ul>\n<li>For each node, we need to find the biggest valued node in its right and attach its arbit pointer to the biggest node.<\/li>\n<li>For nodes \u20187\u2019 and \u20182\u2019, the biggest value in their right is node \u201812\u2019 so, we will make the arbit pointer of both the nodes point to node with value \u201812\u2019.<\/li>\n<li>Similarly, for nodes \u201812\u2019 and \u20181\u2019, the biggest value in their right is node \u20188\u2019 so, we will make the arbit pointer of both the nodes point to node with value  \u20188\u2019.<\/li>\n<li>And for node \u20188\u2019, there is no node on its right side. So, its arbit pointer remains NULL.<\/li>\n<\/ul>\n<p>So, the output will be:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/10\/p_2-4.png\" alt=\"\" \/><\/p>\n<p>Taking another example, if the given linked list is:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/10\/p_3-3.png\" alt=\"\" \/><\/p>\n<ul>\n<li>Now, in this case, for \u20185\u2019 the biggest valued node on the right side of \u20185\u2019 is the node with value \u20189\u2019, so we will make arbit pointer of node \u20185\u2019 point to node with value \u20189\u2019.<\/li>\n<li>Similarly, for each node, we will make their arbit pointer point to the greatest valued node on their right side. Arbit of \u20189\u2019 will point to \u20188\u2019, arbit of \u20187\u2019 will point to \u20188\u2019, arbit of \u20188\u2019 wil point to \u20186\u2019 and arbit of \u20186\u2019 will point to NULL as there are no nodes on right size of the node with value \u20186\u2019.<\/li>\n<\/ul>\n<p>So, our output will be:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/10\/p_4-2.png\" alt=\"\" \/><\/p>\n<p>Now, I think from the above examples, the problem statement is clear. Let\u2019s see how we can approach it.<\/p>\n<p>Before moving to the approach section, try to think about how you can approach this problem.<\/p>\n<ul>\n<li>If stuck, no problem, we will thoroughly see how we can approach this problem in the next section.<\/li>\n<\/ul>\n<p>Let\u2019s move to the approach section.<\/p>\n<h2>Approach 1<\/h2>\n<p>Our approach will be simple:<\/p>\n<ul>\n<li>We will keep two iterators for iterating the list.<\/li>\n<li>Once we fix the first iterator, we will move the second iterator from first iterators next till the end of the list to find the maximum valued node.<\/li>\n<li>After that, we will connect the arbit pointer of the node pointed by the first iterator to the maximum valued node found by the second iterator.<\/li>\n<li>We repeat the same process for each node.<\/li>\n<\/ul>\n<p><strong>Time Complexity:<\/strong> O(n<sup>2<\/sup>), n is the number of nodes in the list.<br \/>\n<strong>Space Complexity:<\/strong> O(1), no extra space used.<\/p>\n<p>The above approach seems trivial but, it has a huge time complexity of O(n<sup>2<\/sup>). Can we reduce that and make our code more efficient in terms of time?<\/p>\n<ul>\n<li>The answer is yes, and let us see the way to do that in the below approach.<\/li>\n<\/ul>\n<p>Let\u2019s move to a more optimized approach.<\/p>\n<h2>Approach 2<\/h2>\n<ul>\n<li>Every time, to find the greatest valued node corresponding to a node, we need to look right in the list (iterate the list from node&#8217;s next to the end of the list), to make things simpler, we can think of iterating the list from end to start.<\/li>\n<li>We cannot iterate the list backward so, we need to reverse the list first, if we want to do so.<\/li>\n<li>Now, after reversing the list, we only need to keep the address of the max-valued node in a variable and update it on each iteration.<\/li>\n<li>On reaching each node, we will have a max valued node in its left, stored in a variable, and we just need to connect the node\u2019s <strong>arbit<\/strong> pointer to the stored node.<\/li>\n<li>Finally, after connecting the <strong>arbit<\/strong> pointers of each node of the list, we need to reverse the list again to keep it to its original form.<\/li>\n<\/ul>\n<h2>Algorithm<\/h2>\n<ul>\n<li>First, reverse the given linked list.<\/li>\n<li>Initialize a pointer <strong>max_node<\/strong> with the first node in the reversed list.<\/li>\n<li>Initialize a pointer <strong>curr<\/strong> with the second node in the reversed list.<\/li>\n<li>Run a while loop till <strong>curr<\/strong> is not NULL.<\/li>\n<li>Update arbit pointer of <strong>curr<\/strong> node with <strong>max_node<\/strong>.<\/li>\n<li>If <strong>curr<\/strong> data is greater than <strong>max_node<\/strong> data, then update <strong>max_node<\/strong> with <strong>curr<\/strong>.<\/li>\n<li>Advance <strong>curr<\/strong> by one node.<\/li>\n<li>Again reverse the list and return it.<\/li>\n<\/ul>\n<h3>Dry Run<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/10\/p_5-2.png\" alt=\"\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes.com\/blog\/wp-content\/uploads\/2021\/10\/p_6-1.png\" alt=\"\" \/><\/p>\n<h2>Code Implementation<\/h2>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_5120 {\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_5120 .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_5120 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_5120 .wpsm_nav-tabs > li.active > a, #tab_container_5120 .wpsm_nav-tabs > li.active > a:hover, #tab_container_5120 .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_5120 .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_5120 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_5120 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_5120 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_5120 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_5120 .wpsm_nav-tabs > li > a:hover , #tab_container_5120 .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_5120 .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_5120 .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_5120 .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_5120 .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_5120 .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_5120 .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_5120 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_5120 .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_5120 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_5120 .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_5120 .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_5120\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_5120\">\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_5120_1\" aria-controls=\"tabs_desc_5120_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_5120_2\" aria-controls=\"tabs_desc_5120_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_5120_3\" aria-controls=\"tabs_desc_5120_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_5120_4\" aria-controls=\"tabs_desc_5120_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_5120\">\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_5120_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&lt;bits stdc++.h=&quot;&quot;&gt;\r\nusing namespace std;\r\n\r\n\/\/ class with constructor for a node of Linked list\r\nclass Node {\r\n    public:\r\n    int data;\r\n    Node* next,*arbit;\r\n    \/\/ constructor\r\n    Node(int x){\r\n        data = x;\r\n        next = NULL;\r\n            arbit = NULL;\r\n    }\r\n};\r\n\r\n\/\/ This function reverses the given list and returns\r\n\/\/ the head of the reversed list\r\nNode* reverse(Node *head)\r\n{\r\n    Node *prev = NULL, *current = head, *next;\r\n    while (current != NULL)\r\n    {\r\n        next  = current-&gt;next;\r\n        current-&gt;next = prev;\r\n        prev = current;\r\n        current = next;\r\n    }\r\n    return prev;\r\n}\r\n\r\n\/\/ This function assigns the correct node address to each node&rsquo;s\r\n\/\/ arbit pointer\r\nNode* solve(Node *head)\r\n{\r\n    \/\/ first reverse the given list\r\n    head = reverse(head);\r\n \r\n    \/\/ Initialize a pointer with first node of \r\n    \/\/ reversed list\r\n    Node *max_node = head;\r\n \r\n    \/\/ Initialize a pointer to traverse the list\r\n    Node *curr = head-&gt;next;\r\n    while (curr != NULL)\r\n    {\r\n        \/\/ connect the curr pointer with max_node\r\n        \/\/ pointer which will have the maximum valued\r\n        \/\/ node's value in left\r\n        curr-&gt;arbit = max_node;\r\n \r\n        \/\/ If this node is greater than max_node\r\n        \/\/ then update the max_node \r\n        if (max_node-&gt;data &lt; curr-&gt;data)\r\n            max_node = curr;\r\n \r\n        \/\/ advance curr to move to next node \r\n        curr = curr-&gt;next;\r\n    }\r\n \r\n    \/\/ again reverse the list to bring it again\r\n    \/\/ to its original form\r\n    return reverse(head);\r\n}\r\n\r\n\/\/ this function will print value of each node's\r\n\/\/ next node and arbit node\r\nvoid checkValue(Node *head)\r\n{\r\n    cout&lt;&lt;&quot;node&#92;tNext Pointer&#92;tArbit Pointer&#92;n&quot;;\r\n    while (head!=NULL)\r\n    {\r\n        cout &lt;&lt; head-&gt;data &lt;&lt; &quot;&#92;t&#92;t&quot;;\r\n \r\n        if (head-&gt;next)\r\n            cout &lt;&lt; head-&gt;next-&gt;data &lt;&lt; &quot;&#92;t&#92;t&quot;;\r\n        else cout &lt;&lt; &quot;NULL&quot; &lt;&lt; &quot;&#92;t&#92;t&quot;;\r\n \r\n        if (head-&gt;arbit)\r\n            cout &lt;&lt; head-&gt;arbit-&gt;data;\r\n        else cout &lt;&lt; &quot;NULL&quot;;\r\n \r\n        cout &lt;&lt; endl;\r\n        head = head-&gt;next;\r\n    }\r\n}\r\n\r\n\/\/ main function\r\nint main()\r\n{\r\n    Node *head = new Node(7);\r\n    head-&gt;next = new Node(2);\r\n    head-&gt;next-&gt;next = new Node(12);\r\n    head-&gt;next-&gt;next-&gt;next = new Node(1);\r\n    head-&gt;next-&gt;next-&gt;next-&gt;next = new Node(8);\r\n    \r\n    head = solve(head);\r\n    checkValue(head);\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\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane \" id=\"tabs_desc_5120_2\">\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\r\n#include&lt;stdio.h&gt;\r\n#include&lt;stdlib.h&gt;\r\n\r\nstruct Node\r\n{\r\n    int data;\r\n    struct Node* next, *arbit;\r\n};\r\n \r\n\/\/ This function populates arbit pointer in every\r\n\/\/ node to the greatest value to its right.\r\nvoid populateArbit(struct Node *head)\r\n{\r\n    \/\/ using static maxNode to keep track of maximum\r\n    \/\/ orbit node address on right side\r\n    static struct Node *maxNode;\r\n \r\n    \/\/ if head is null simply return the list\r\n    if (head == NULL)\r\n        return;\r\n \r\n    \/* if head-&gt;next is null it means we reached at\r\n       the last node just update the max and maxNode *\/\r\n    if (head-&gt;next == NULL)\r\n    {\r\n        maxNode = head;\r\n        return;\r\n    }\r\n \r\n    \/* Calling the populateArbit to the next node *\/\r\n    populateArbit(head-&gt;next);\r\n \r\n    \/* updating the arbit node of the current\r\n     node with the maximum value on the right side *\/\r\n    head-&gt;arbit = maxNode;\r\n \r\n    \/* if current Node value id greater then\r\n     the previous right node then  update it *\/\r\n    if (head-&gt;data &gt; maxNode-&gt;data)\r\n        maxNode = head;\r\n \r\n   return;\r\n}\r\n \r\n\/\/ Utility function to print result linked list\r\nvoid printNextArbitPointers(struct Node *node)\r\n{\r\n    printf(&quot;Node&#92;tNext Pointer&#92;tArbit Pointer&#92;n&quot;);\r\n    while (node!=NULL)\r\n    {\r\n        printf(&quot;%d&#92;t&#92;t&quot;,node-&gt;data);\r\n \r\n        if(node-&gt;next)\r\n            printf(&quot;%d &#92;t&#92;t&quot;,node-&gt;next-&gt;data);\r\n        else printf(&quot;&#92;t&#92;t&quot;,&quot;NULL&quot;);\r\n \r\n        if(node-&gt;arbit)\r\n            printf(&quot;%d &quot;,node-&gt;arbit-&gt;data);\r\n        else printf(&quot;NULL&quot;);\r\n \r\n        printf(&quot;&#92;n&quot;);\r\n        node = node-&gt;next;\r\n    }\r\n}\r\n \r\n\/* Function to create a new node with given data *\/\r\nstruct Node *newNode(int data)\r\n{\r\n    struct Node* new_node = (struct Node*)malloc(sizeof(struct Node*));\r\n    new_node-&gt;data = data;\r\n    new_node-&gt;next = NULL;\r\n    return new_node;\r\n}\r\n \r\n\/* Driver program to test above functions*\/\r\nint main()\r\n{\r\n    struct Node *head = newNode(5);\r\n    head-&gt;next = newNode(10);\r\n    head-&gt;next-&gt;next = newNode(2);\r\n    head-&gt;next-&gt;next-&gt;next = newNode(3);\r\n \r\n    populateArbit(head);\r\n \r\n    printf(&quot;Resultant Linked List is: &#92;n&quot;);\r\n    printNextArbitPointers(head);\r\n \r\n    return 0;\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_5120_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\nclass PrepBytes\r\n{\r\n\r\n\/* Link list node *\/\r\nstatic class Node\r\n{\r\n\tint data;\r\n\tNode next, arbit;\r\n}\r\n\r\n\/* Function to reverse the linked list *\/\r\nstatic Node reverse(Node head)\r\n{\r\n\tNode prev = null, current = head, next = null;\r\n\twhile (current != null)\r\n\t{\r\n\t\tnext = current.next;\r\n\t\tcurrent.next = prev;\r\n\t\tprev = current;\r\n\t\tcurrent = next;\r\n\t}\r\n\treturn prev;\r\n}\r\n\r\n\/\/ This function populates arbit pointer in every\r\n\/\/ node to the greatest value to its right.\r\nstatic Node populateArbit(Node head)\r\n{\r\n\t\/\/ Reverse given linked list\r\n\thead = reverse(head);\r\n\r\n\t\/\/ Initialize pointer to maximum value node\r\n\tNode max = head;\r\n\r\n\t\/\/ Traverse the reversed list\r\n\tNode temp = head.next;\r\n\twhile (temp != null)\r\n\t{\r\n\t\t\/\/ Connect max through arbit pointer\r\n\t\ttemp.arbit = max;\r\n\r\n\t\t\/\/ Update max if required\r\n\t\tif (max.data &lt; temp.data)\r\n\t\t\tmax = temp;\r\n\r\n\t\t\/\/ Move ahead in reversed list\r\n\t\ttemp = temp.next;\r\n\t}\r\n\r\n\t\/\/ Reverse modified linked list and return\r\n\t\/\/ head.\r\n\treturn reverse(head);\r\n}\r\n\r\n\/\/ Utility function to print result linked list\r\nstatic void printNextArbitPointers(Node node)\r\n{\r\n\tSystem.out.println(&quot;Node&#92;tNext Pointer&#92;tArbit Pointer&quot;);\r\n\twhile (node != null)\r\n\t{\r\n\t\tSystem.out.print(node.data + &quot;&#92;t&#92;t&quot;);\r\n\r\n\t\tif (node.next != null)\r\n\t\t\tSystem.out.print(node.next.data + &quot;&#92;t&#92;t&quot;);\r\n\t\telse\r\n\t\t\tSystem.out.print(&quot;NULL&quot; +&quot;&#92;t&#92;t&quot;);\r\n\r\n\t\tif (node.arbit != null)\r\n\t\t\tSystem.out.print(node.arbit.data);\r\n\t\telse\r\n\t\t\tSystem.out.print(&quot;NULL&quot;);\r\n\r\n\t\tSystem.out.println();\r\n\t\tnode = node.next;\r\n\t}\r\n}\r\n\r\n\/* Function to create a new node with given data *\/\r\nstatic Node newNode(int data)\r\n{\r\n\tNode new_node = new Node();\r\n\tnew_node.data = data;\r\n\tnew_node.next = null;\r\n\treturn new_node;\r\n}\r\n\r\n\/* Driver code*\/\r\npublic static void main(String[] args)\r\n{\r\n\tNode head = newNode(7);\r\n\thead.next = newNode(2);\r\n\thead.next.next = newNode(12);\r\n\thead.next.next.next = newNode(1);\r\n\thead.next.next.next.next = newNode(8);\r\n\r\n\thead = populateArbit(head);\r\n\r\n\tSystem.out.println(&quot;Resultant Linked List is: &quot;);\r\n\tprintNextArbitPointers(head);\r\n\r\n}\r\n}\r\n\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_5120_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# Node class\r\nclass Node:\r\n\r\n\tdef __init__(self, data):\r\n\t\tself.data = data\r\n\t\tself.next = None\r\n\t\tself.arbit = None\r\n\r\n# Function to reverse the linked list\r\ndef reverse(head):\r\n\r\n\tprev = None\r\n\tcurrent = head\r\n\tnext = None\r\n\twhile (current != None):\r\n\t\r\n\t\tnext = current.next\r\n\t\tcurrent.next = prev\r\n\t\tprev = current\r\n\t\tcurrent = next\r\n\t\r\n\treturn prev\r\n\r\n# This function populates arbit pointer in every\r\n# node to the greatest value to its right.\r\ndef populateArbit(head):\r\n\r\n\thead = reverse(head)\r\n\r\n\tmax = head\r\n\r\n\ttemp = head.next\r\n\twhile (temp != None):\r\n\r\n\t\ttemp.arbit = max\r\n\r\n\t\tif (max.data &lt; temp.data):\r\n\t\t\tmax = temp\r\n\r\n\t\ttemp = temp.next\r\n\r\n\treturn reverse(head)\r\n\r\n# Utility function to print result linked list\r\ndef printNextArbitPointers(node):\r\n\r\n\tprint(&quot;Node&#92;tNext Pointer&#92;tArbit Pointer&#92;n&quot;)\r\n\twhile (node != None):\r\n\t\r\n\t\tprint( node.data , &quot;&#92;t&#92;t&quot;,end = &quot;&quot;)\r\n\r\n\t\tif (node.next != None):\r\n\t\t\tprint( node.next.data , &quot;&#92;t&#92;t&quot;,end = &quot;&quot;)\r\n\t\telse :\r\n\t\t\tprint( &quot;None&quot; , &quot;&#92;t&#92;t&quot;,end = &quot;&quot;)\r\n\r\n\t\tif (node.arbit != None):\r\n\t\t\tprint( node.arbit.data,end = &quot;&quot;)\r\n\t\telse :\r\n\t\t\tprint( &quot;None&quot;,end = &quot;&quot;)\r\n\t\t\r\n\t\tprint(&quot;&#92;n&quot;)\r\n\t\tnode = node.next\r\n\t\r\n# Function to create a new node with given data\r\ndef newNode(data):\r\n\r\n\tnew_node = Node(0)\r\n\tnew_node.data = data\r\n\tnew_node.next = None\r\n\treturn new_node\r\n\r\n\r\nhead = newNode(7)\r\nhead.next = newNode(2)\r\nhead.next.next = newNode(12)\r\nhead.next.next.next = newNode(1)\r\nhead.next.next.next.next = newNode(8)\r\n\r\nhead = populateArbit(head)\r\n\r\nprint(&quot;Resultant Linked List is: &#92;n&quot;)\r\nprintNextArbitPointers(head)\r\n\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_5120 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_5120 a\"),jQuery(\"#tab-content_5120\"));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<table>\n<thead>\n<tr>\n<th>node<\/th>\n<th>Next Pointer<\/th>\n<th>Arbit Pointer<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>7<\/td>\n<td>2<\/td>\n<td>12<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>12<\/td>\n<td>12<\/td>\n<\/tr>\n<tr>\n<td>12<\/td>\n<td>1<\/td>\n<td>8<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>8<\/td>\n<td>8<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>NULL<\/td>\n<td>NULL<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Time Complexity:<\/strong> O(n), where n is the total number of nodes in the list<\/p>\n<p>This blog have tried to explain how you can Point arbit pointer to greatest value right-side node in a linked list in the most optimal way. This is a good problem to strengthen your concepts in LinkedList. Our Expert Mentors have build one linked list questions list which will strengthen your data structures like linked list, you can checkout <a href=\"https:\/\/mycode.prepbytes.com\/interview-coding\/practice\/linked-list\">Prepbytes (Linked List)<\/a> for practicing more questions in linked list.<\/p>\n<h2>FAQ<\/h2>\n<p><strong>1. What pointer points to the next member of the list?<\/strong><br \/>\nA linked list is a set of dynamically allocated nodes, arranged in such a way that each node contains one value and one pointer. The pointer always points to the next member of the list.<\/p>\n<p><strong>2. What are the 4 types of linked list?<\/strong><br \/>\nTypes of Linked List :<\/p>\n<ul>\n<li>Singly Linked List.<\/li>\n<li>Doubly Linked List.<\/li>\n<li>Circular Linked List.<\/li>\n<li>Circular Doubly List.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will discuss one of the famous questions of linked lists \u201cPoint arbit pointer to greatest value right-side node in a linked list\u201d. Having practice questions like \u201cPoint arbit pointer to greatest value right-side node in a linked list\u201d will make your data structures like linked list strong. Now let\u2019s go to [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[125],"tags":[],"class_list":["post-5118","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>Point arbit pointer to greatest value right-side node in a linked list<\/title>\n<meta name=\"description\" content=\"Learn how to point the arbit pointer to the greatest value in the right-side node of a linked list from this blog.\" \/>\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\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Point arbit pointer to greatest value right-side node in a linked list\" \/>\n<meta property=\"og:description\" content=\"Learn how to point the arbit pointer to the greatest value in the right-side node of a linked list from this blog.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/\" \/>\n<meta property=\"og:site_name\" content=\"PrepBytes Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prepbytes0211\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-11T08:21:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-30T05:14:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645011497773-Article_184.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=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/\"},\"author\":{\"name\":\"Prepbytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\"},\"headline\":\"Point arbit pointer to greatest value right-side node in a linked list\",\"datePublished\":\"2021-10-11T08:21:10+00:00\",\"dateModified\":\"2022-11-30T05:14:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/\"},\"wordCount\":1022,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645011497773-Article_184.png\",\"articleSection\":[\"Linked list articles\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/\",\"name\":\"Point arbit pointer to greatest value right-side node in a linked list\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645011497773-Article_184.png\",\"datePublished\":\"2021-10-11T08:21:10+00:00\",\"dateModified\":\"2022-11-30T05:14:05+00:00\",\"description\":\"Learn how to point the arbit pointer to the greatest value in the right-side node of a linked list from this blog.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645011497773-Article_184.png\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645011497773-Article_184.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/43.205.93.38\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linked list articles\",\"item\":\"https:\/\/prepbytes.com\/blog\/category\/linked-list\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Point arbit pointer to greatest value right-side node in a linked list\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/43.205.93.38\/#website\",\"url\":\"http:\/\/43.205.93.38\/\",\"name\":\"PrepBytes Blog\",\"description\":\"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING\",\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/43.205.93.38\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/43.205.93.38\/#organization\",\"name\":\"Prepbytes\",\"url\":\"http:\/\/43.205.93.38\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"contentUrl\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"width\":160,\"height\":160,\"caption\":\"Prepbytes\"},\"image\":{\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/prepbytes0211\/\",\"https:\/\/www.instagram.com\/prepbytes\/\",\"https:\/\/www.linkedin.com\/company\/prepbytes\/\",\"https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\",\"name\":\"Prepbytes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"caption\":\"Prepbytes\"},\"url\":\"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Point arbit pointer to greatest value right-side node in a linked list","description":"Learn how to point the arbit pointer to the greatest value in the right-side node of a linked list from this blog.","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\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/","og_locale":"en_US","og_type":"article","og_title":"Point arbit pointer to greatest value right-side node in a linked list","og_description":"Learn how to point the arbit pointer to the greatest value in the right-side node of a linked list from this blog.","og_url":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2021-10-11T08:21:10+00:00","article_modified_time":"2022-11-30T05:14:05+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645011497773-Article_184.png","type":"","width":"","height":""}],"author":"Prepbytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Prepbytes","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/"},"author":{"name":"Prepbytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e"},"headline":"Point arbit pointer to greatest value right-side node in a linked list","datePublished":"2021-10-11T08:21:10+00:00","dateModified":"2022-11-30T05:14:05+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/"},"wordCount":1022,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645011497773-Article_184.png","articleSection":["Linked list articles"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/","url":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/","name":"Point arbit pointer to greatest value right-side node in a linked list","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645011497773-Article_184.png","datePublished":"2021-10-11T08:21:10+00:00","dateModified":"2022-11-30T05:14:05+00:00","description":"Learn how to point the arbit pointer to the greatest value in the right-side node of a linked list from this blog.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645011497773-Article_184.png","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1645011497773-Article_184.png"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/point-arbit-pointer-to-greatest-value-right-side-node-in-a-linked-list\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/43.205.93.38\/"},{"@type":"ListItem","position":2,"name":"Linked list articles","item":"https:\/\/prepbytes.com\/blog\/category\/linked-list\/"},{"@type":"ListItem","position":3,"name":"Point arbit pointer to greatest value right-side node in a linked list"}]},{"@type":"WebSite","@id":"http:\/\/43.205.93.38\/#website","url":"http:\/\/43.205.93.38\/","name":"PrepBytes Blog","description":"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING","publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/43.205.93.38\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/43.205.93.38\/#organization","name":"Prepbytes","url":"http:\/\/43.205.93.38\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/","url":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","contentUrl":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","width":160,"height":160,"caption":"Prepbytes"},"image":{"@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/prepbytes0211\/","https:\/\/www.instagram.com\/prepbytes\/","https:\/\/www.linkedin.com\/company\/prepbytes\/","https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA"]},{"@type":"Person","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e","name":"Prepbytes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","caption":"Prepbytes"},"url":"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/"}]}},"_links":{"self":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/5118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/comments?post=5118"}],"version-history":[{"count":7,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/5118\/revisions"}],"predecessor-version":[{"id":10841,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/5118\/revisions\/10841"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=5118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=5118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=5118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}