{"id":4684,"date":"2021-09-02T09:43:24","date_gmt":"2021-09-02T09:43:24","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=4684"},"modified":"2023-07-27T12:38:40","modified_gmt":"2023-07-27T12:38:40","slug":"multiplication-of-two-polynomials-using-linked-list","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/","title":{"rendered":"Multiplication of Two Polynomials using Linked List"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644913628868-Learn%20the%20most%20efficient%20way%20to%20multiply%20two%20polynomials%20using%20Linked%20List._Artboard%202.png\" alt=\"\" \/><\/p>\n<p>To perform polynomial multiplication in C, we can represent each polynomial as a linked list of nodes, each with a coefficient and an exponent. The exponent represents the degree. The polynomial multiplication using a linked list in c has two polynomials that are stored in two linked lists, and we must perform operations to obtain the result as a polynomial multiplication. g a linked list in c has two polynomials which are stored in two linked lists, we have to perform operations to give the result as a polynomial multiplication. One of the most crucial data structures to learn while preparing for interviews is the linked list. We start with two polynomials in the form of linked lists, and we need to make a new list that contains the multiplicative product of the given polynomials.<\/p>\n<p>We assume two polynomials in the form of linked lists, and we need to create a new list containing the multiplicative product of the given polynomials.<\/p>\n<h2>Multiplication of 2 for Polynomial Multiplication using Linked List<\/h2>\n<p>Let\u2019s try to understand the problem with the help of examples by referring to the websites to learn to program.<\/p>\n<p>Suppose the given linked lists are:<br \/>\n<strong>Poly1:<\/strong> 3&#215;3 + 6&#215;1 \u2013 9<br \/>\n<strong>Poly2:<\/strong> 9&#215;3 \u2013 8&#215;2 + 7&#215;1 + 2<\/p>\n<ul>\n<li>Now, according to the problem statement, we need to multiply these polynomials Poly1 and Poly2.<\/li>\n<li>So we will multiply each term in Poly1 with every term in Poly2, and then we will add up all the terms with the same power of x such that each term in the final resultant polynomial multiplication using linked list has a different power of x.<\/li>\n<\/ul>\n<p><strong>Output<\/strong><\/p>\n<pre><code>Resultant Polynomial: 27x6 \u2013 24x5 + 75x4 \u2013 123x3 + 114x2 \u2013 51x1 \u2013 18<\/code><\/pre>\n<p><strong>Some other examples:<\/strong><br \/>\n<strong>Input 1<\/strong><\/p>\n<pre><code>Poly1: 6x1 \u2013 9\nPoly2: 7x1 + 2<\/code><\/pre>\n<p><strong>Output 1<\/strong><\/p>\n<pre><code>Resultant Polynomial: 42x2 \u2013 51x1 \u2013 18<\/code><\/pre>\n<p><strong>Input 2<\/strong><\/p>\n<pre><code>Poly1: 8x1 + 7\nPoly2: 4x2 + 5<\/code><\/pre>\n<p><strong>Output 2<\/strong><\/p>\n<pre><code>Resultant Polynomial: 32x3 + 28x2 + 40x1 + 35<\/code><\/pre>\n<p>Now I think from the above examples the problem statement is clear. So, let\u2019s see How can we do polynomial multiplication using linked list?<\/p>\n<h3>Approach and Algorithm of Polynomial Multiplication using Linked List in C<\/h3>\n<p>Here is the algorithm for polynomial multiplication using linked lists in C:<\/p>\n<ul>\n<li>First define the node structure to hold the coefficient and exponent values, as well as a pointer to the next node.<\/li>\n<li>Create a function to create a new node with the specified coefficient and exponent values.<\/li>\n<li>Create a function to insert a new node into a linked list based on its exponent value.<\/li>\n<li>Create a function to print the linked list.<\/li>\n<li>Create a function to multiply two polynomials represented as linked lists.<\/li>\n<li>Iterate over each term in the first polynomial, multiply it with each term in the second polynomial, and add the resulting term to the result polynomial using the insert_node() function.<\/li>\n<li>Return the resulting polynomial as a linked list.<\/li>\n<\/ul>\n<h3>Dry Run of Polynomial Multiplication using Linked List in C<\/h3>\n<p>Let\u2019s dry run the polynomial multiplication using linked list with an example:<\/p>\n<p><strong>Poly1:<\/strong> 3x^3 + 6x^1 \u2013 9<br \/>\n<strong>Poly2:<\/strong> 9x^3 \u2013 8x^2 + 7x^1 + 2<\/p>\n<p>To multiply the above polynomials <strong>Poly1<\/strong> and <strong>Poly2<\/strong> we will have to perform the following operations:<\/p>\n<p>We have to multiply all the terms of <strong>Poly1<\/strong> one by one with every term of <strong>Poly2<\/strong>, so first, we will multiply 3&#215;3 with every other term in <strong>Poly2<\/strong>.(result: 27&#215;6 \u2013 24&#215;5 + 21&#215;4 + 6&#215;3)<\/p>\n<p>Now we take 6&#215;1 and multiply it with every other term in <strong>Poly2<\/strong>.(result: 27&#215;6 \u2013 24&#215;5 + 21&#215;4 + 6&#215;3 + 54&#215;4 \u2013 48&#215;3 + 42&#215;2 + 12&#215;1)<\/p>\n<p>Now we take -9 and multiply it with every other term in <strong>Poly2<\/strong>.(result: 27&#215;6 \u2013 24&#215;5 + 21&#215;4 + 6&#215;3 + 54&#215;4 \u2013 48&#215;3 + 42&#215;2 + 12&#215;1 \u2013 81&#215;3 + 72&#215;2 \u2013 63&#215;1 \u2013 18)<\/p>\n<p>We will remove all the duplicates, i.e., add the value of nodes with the same powers.<\/p>\n<p>So the final result: 27&#215;6 \u2013 24&#215;5 + 75&#215;4 \u2013 123&#215;3 + 114&#215;2 \u2013 51&#215;1 \u2013 18<\/p>\n<p>You can take examples by yourself to get a better understanding of the problem.<\/p>\n<h3>Code Implementation of Polynomial Multiplication using Linked List in C<\/h3>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_4685 {\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_4685 .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_4685 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_4685 .wpsm_nav-tabs > li.active > a, #tab_container_4685 .wpsm_nav-tabs > li.active > a:hover, #tab_container_4685 .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_4685 .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_4685 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_4685 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_4685 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_4685 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_4685 .wpsm_nav-tabs > li > a:hover , #tab_container_4685 .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_4685 .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_4685 .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_4685 .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_4685 .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_4685 .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_4685 .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_4685 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_4685 .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_4685 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_4685 .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_4685 .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_4685\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_4685\">\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_4685_1\" aria-controls=\"tabs_desc_4685_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_4685_2\" aria-controls=\"tabs_desc_4685_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>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_4685_3\" aria-controls=\"tabs_desc_4685_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>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_4685\">\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_4685_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 &lt;stdio.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n\r\ntypedef struct Node\r\n{\r\n    \/\/ Define useful field of Node\r\n    int data;\r\n    int power;\r\n    struct Node * next;\r\n}Node;\r\n\r\nNode * getNode(int data, int power)\r\n{\r\n    \/\/ Create dynamic memory of Node\r\n    Node * ref = (Node * ) malloc(sizeof(Node));\r\n    if (ref == NULL)\r\n    {\r\n        \/\/ Failed to create memory \r\n        return NULL;\r\n    }\r\n    ref-&gt;data = data;\r\n    ref-&gt;power = power;\r\n    ref-&gt;next = NULL;\r\n    return ref;\r\n}\r\n\/\/ Update node value\r\nvoid updateRecord(Node * ref, int data, int power)\r\n{\r\n    ref-&gt;data = data;\r\n    ref-&gt;power = power;\r\n}\r\ntypedef struct MultiplyPolynomial\r\n{\r\n    \/\/ Define useful field of MultiplyPolynomial\r\n    struct Node * head;\r\n}MultiplyPolynomial;\r\n\r\nMultiplyPolynomial * getMultiplyPolynomial()\r\n{\r\n    \/\/ Create dynamic memory of MultiplyPolynomial\r\n    MultiplyPolynomial * ref = (MultiplyPolynomial * )\r\n                    malloc(sizeof(MultiplyPolynomial));\r\n    if (ref == NULL)\r\n    {\r\n        \/\/ Failed to create memory \r\n        return NULL;\r\n    }\r\n    ref-&gt;head = NULL;\r\n    return ref;\r\n}\r\n\/\/ Insert Node element\r\nvoid insert(MultiplyPolynomial * ref, int data, int power)\r\n{\r\n    if (ref-&gt;head == NULL)\r\n    {\r\n        \/\/ Add first node\r\n        ref-&gt;head = getNode(data, power);\r\n    }\r\n    else\r\n    {\r\n        Node * node = NULL;\r\n        Node * temp = ref-&gt;head;\r\n        Node * location = NULL;\r\n        \/\/ Find the valid new node location\r\n        while (temp != NULL &amp;&amp; temp-&gt;power &gt;= power)\r\n        {\r\n            location = temp;\r\n            temp = temp-&gt;next;\r\n        }\r\n        if (location != NULL &amp;&amp; location-&gt;power == power)\r\n        {\r\n            \/\/ When polynomial power already exists\r\n            \/\/ Then add current add to previous data\r\n            location-&gt;data = location-&gt;data + data;\r\n        }\r\n        else\r\n        {\r\n            node = getNode(data, power);\r\n            if (location == NULL)\r\n            {\r\n                \/\/ When add node in begining\r\n                node-&gt;next = ref-&gt;head;\r\n                ref-&gt;head = node;\r\n            }\r\n            else\r\n            {\r\n                \/\/ When adding node in intermediate \r\n                \/\/ location or end location\r\n                node-&gt;next = location-&gt;next;\r\n                location-&gt;next = node;\r\n            }\r\n        }\r\n    }\r\n}\r\n\/\/ Perform multiplication of given polynomial\r\nMultiplyPolynomial * multiplyPolynomials(\r\n  MultiplyPolynomial * ref, MultiplyPolynomial * other)\r\n{\r\n    \/\/ Define some useful variable\r\n    MultiplyPolynomial * result = getMultiplyPolynomial();\r\n    \/\/ Get first node of polynomial\r\n    Node * poly1 = ref-&gt;head;\r\n    Node * temp = other-&gt;head;\r\n    int power_value = 0;\r\n    int coefficient = 0;\r\n    \/\/ Execute loop until when polynomial are exist\r\n    while (poly1 != NULL)\r\n    {\r\n        temp = other-&gt;head;\r\n        while (temp != NULL)\r\n        {\r\n            \/\/ Get result info\r\n            power_value = poly1-&gt;power + temp-&gt;power;\r\n            coefficient = poly1-&gt;data * temp-&gt;data;\r\n            insert(result, coefficient, power_value);\r\n            \/\/ Visit to next node\r\n            temp = temp-&gt;next;\r\n        }\r\n        \/\/ Visit to next node\r\n        poly1 = poly1-&gt;next;\r\n    }\r\n    \/\/ return first node\r\n    return result;\r\n}\r\n\/\/ Display given polynomial nodes\r\nvoid display(MultiplyPolynomial * ref)\r\n{\r\n    if (ref-&gt;head == NULL)\r\n    {\r\n        printf(&quot;Empty Polynomial &quot;);\r\n    }\r\n    printf(&quot; &quot;);\r\n    Node * temp = ref-&gt;head;\r\n    while (temp != NULL)\r\n    {\r\n        if (temp != ref-&gt;head)\r\n        {\r\n            printf(&quot; + %d&quot;, temp-&gt;data);\r\n        }\r\n        else\r\n        {\r\n            printf(&quot;%d&quot;,temp-&gt;data);\r\n        }\r\n        if (temp-&gt;power != 0)\r\n        {\r\n            printf(&quot;x^%d&quot;, temp-&gt;power);\r\n        }\r\n        \/\/ Visit to next node\r\n        temp = temp-&gt;next;\r\n    }\r\n    printf(&quot;&#92;n&quot;);\r\n}\r\nint main()\r\n{\r\n    MultiplyPolynomial * a = getMultiplyPolynomial();\r\n    MultiplyPolynomial * b = getMultiplyPolynomial();\r\n    \/\/ Add node in polynomial A\r\n    insert(a, 9, 3);\r\n    insert(a, 4, 2);\r\n    insert(a, 3, 0);\r\n    insert(a, 7, 1);\r\n    insert(a, 3, 4);\r\n    \/\/ Add node in polynomial b\r\n    insert(b, 7, 3);\r\n    insert(b, 4, 0);\r\n    insert(b, 6, 1);\r\n    insert(b, 1, 2);\r\n    \/\/ Display Polynomial nodes\r\n    printf(&quot;&#92;n Polynomial A&#92;n&quot;);\r\n    display(a);\r\n    printf(&quot; Polynomial B&#92;n&quot;);\r\n    display(b);\r\n    MultiplyPolynomial * result = multiplyPolynomials(a, b);\r\n    \/\/ Display calculated result\r\n    printf(&quot; Result&#92;n&quot;);\r\n    display(result);\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_4685_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\nimport java.util.*;\r\nclass PrepBytes\r\n{\r\n \r\nstatic class Node {\r\n    int coeff, power;\r\n    Node next;\r\n};\r\n \r\nstatic Node addnode(Node start, int coeff, int power)\r\n{\r\n    Node newnode = new Node();\r\n    newnode.coeff = coeff;\r\n    newnode.power = power;\r\n    newnode.next = null;\r\n \r\n    if (start == null)\r\n        return newnode;\r\n \r\n    Node ptr = start;\r\n    while (ptr.next != null)\r\n        ptr = ptr.next;\r\n    ptr.next = newnode;\r\n \r\n    return start;\r\n}\r\n \r\nstatic void printList( Node ptr)\r\n{\r\n    while (ptr.next != null) {\r\n        System.out.print( ptr.coeff + &quot;x^&quot; + ptr.power + &quot; + &quot;);\r\n \r\n        ptr = ptr.next;\r\n    }\r\n    System.out.print( ptr.coeff  +&quot;&#92;n&quot;);\r\n}\r\n \r\nstatic void removeDuplicates(Node start)\r\n{\r\n    Node ptr1, ptr2, dup;\r\n    ptr1 = start;\r\n \r\n    while (ptr1 != null &amp;&amp; ptr1.next != null) {\r\n        ptr2 = ptr1;\r\n \r\n        while (ptr2.next != null) {\r\n \r\n            if (ptr1.power == ptr2.next.power) {\r\n \r\n                ptr1.coeff = ptr1.coeff + ptr2.next.coeff;\r\n                dup = ptr2.next;\r\n                ptr2.next = ptr2.next.next;\r\n \r\n            }\r\n            else\r\n                ptr2 = ptr2.next;\r\n        }\r\n        ptr1 = ptr1.next;\r\n    }\r\n}\r\n \r\nstatic Node multiply(Node poly1, Node poly2,\r\n            Node poly3)\r\n{\r\n \r\n    Node ptr1, ptr2;\r\n    ptr1 = poly1;\r\n    ptr2 = poly2;\r\n    while (ptr1 != null) {\r\n        while (ptr2 != null) {\r\n            int coeff, power;\r\n \r\n            coeff = ptr1.coeff * ptr2.coeff;\r\n \r\n            power = ptr1.power + ptr2.power;\r\n \r\n            poly3 = addnode(poly3, coeff, power);\r\n \r\n \r\n            ptr2 = ptr2.next;\r\n        }\r\n \r\n        ptr2 = poly2;\r\n  \r\n        ptr1 = ptr1.next;\r\n    }\r\n  \r\n    removeDuplicates(poly3);\r\n    return poly3;\r\n}\r\n \r\n \r\npublic static void main(String args[])\r\n{\r\n \r\n    Node poly1 = null, poly2 = null, poly3 = null;\r\n \r\n    poly1 = addnode(poly1, 3, 2);\r\n    poly1 = addnode(poly1, 5, 1);\r\n    poly1 = addnode(poly1, 6, 0);\r\n \r\n    poly2 = addnode(poly2, 6, 1);\r\n    poly2 = addnode(poly2, 8, 0);\r\n    \r\n    poly3 = multiply(poly1, poly2, poly3);\r\n \r\n    System.out.print( &quot;Resultant Polynomial: &quot;);\r\n    printList(poly3);\r\n}\r\n \r\n}\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\r\n\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane \" id=\"tabs_desc_4685_3\">\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\nclass Node:\r\n    def __init__(self):    \r\n        self.coeff = None\r\n        self.power = None\r\n        self.next = None\r\n\r\ndef addnode(start, coeff, power):\r\n\r\n    newnode = Node()\r\n    newnode.coeff = coeff\r\n    newnode.power = power\r\n    newnode.next = None\r\n\r\n    if (start == None):\r\n        return newnode\r\n\r\n    ptr = start\r\n    while (ptr.next != None):\r\n        ptr = ptr.next\r\n    ptr.next = newnode\r\n    return start\r\n\r\ndef printList(ptr):\r\n\r\n    while (ptr.next != None):\r\n        print(str(ptr.coeff) + 'x^' + str(ptr.power), end = '')\r\n        if( ptr.next != None and ptr.next.coeff &gt;= 0):\r\n            print('+', end = '')\r\n        ptr = ptr.next\r\n    print(ptr.coeff)\r\n    \r\ndef removeDuplicates(start):\r\n    ptr2 = None\r\n    dup = None\r\n    ptr1 = start\r\n\r\n    while (ptr1 != None and ptr1.next != None):\r\n        ptr2 = ptr1\r\n\r\n        while (ptr2.next != None):\r\n\r\n            if (ptr1.power == ptr2.next.power):\r\n\r\n                ptr1.coeff = ptr1.coeff + ptr2.next.coeff\r\n                dup = ptr2.next\r\n                ptr2.next = ptr2.next.next\r\n            \r\n            else:\r\n                ptr2 = ptr2.next\r\n        \r\n        ptr1 = ptr1.next\r\n    \r\ndef multiply(poly1, Npoly2, poly3):\r\n\r\n    ptr1 = poly1\r\n    ptr2 = poly2\r\n    \r\n    while (ptr1 != None):\r\n        while (ptr2 != None):\r\n\r\n            coeff = ptr1.coeff * ptr2.coeff\r\n            power = ptr1.power + ptr2.power\r\n            poly3 = addnode(poly3, coeff, power)\r\n            ptr2 = ptr2.next\r\n\r\n        ptr2 = poly2\r\n        ptr1 = ptr1.next\r\n    \r\n    removeDuplicates(poly3)\r\n    return poly3\r\n\r\nif __name__=='__main__':\r\n    poly1 = None\r\n    poly2 = None\r\n    poly3 = None\r\n\r\n    poly1 = addnode(poly1, 3, 2)\r\n    poly1 = addnode(poly1, 5, 1)\r\n    poly1 = addnode(poly1, 6, 0)\r\n\r\n    poly2 = addnode(poly2, 6, 1)\r\n    poly2 = addnode(poly2, 8, 0)\r\n\r\n    poly3 = multiply(poly1, poly2, poly3)\r\n\r\n    print(&quot;Resultant Polynomial:- &quot;, end = '')\r\n    printList(poly3)\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_4685 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_4685 a\"),jQuery(\"#tab-content_4685\"));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<pre><code>Resultant Polynomial: 18x3 + 54x2 + 76x1 + 48<\/code><\/pre>\n<p><strong>Time Complexity of polynomial multiplication using linked list :<\/strong> The time complexity of polynomial multiplication using linked list is O(n*m), where n is the total number of nodes in the first polynomial and m is the number of nodes in the second polynomial.<\/p>\n<p><strong>Space Complexity of polynomial multiplication using linked list:<\/strong> The space complexity of polynomial multiplication using linked list is O(n+m), we need to store all the multiplied values in the node.<\/p>\n<p><strong>Conclusion<\/strong><br \/>\nPolynomial multiplication with linked lists is a quick and easy way to multiply polynomials. Polynomial multiplication in C is accomplished by expressing each polynomial as a linked list of nodes, multiplying each term in one polynomial by each term in the other polynomial, and adding the resultant terms to a new linked list to represent the final polynomial. This polynomial multiplication method in C may be simply implemented by utilising the functions. The linked list is an important topic in Data Structures that plays a significant part in the placement of any job applicant in the IT sector.<\/p>\n<h2>FAQ Related to Polynomial Multiplication Using Linked List<\/h2>\n<p><strong>Q1. What is a linked list?<\/strong><br \/>\n<strong>Ans:<\/strong> A linked list is a data structure that consists of a sequence of nodes, each containing some data and a pointer to the next node in the list.<\/p>\n<p><strong>Q2. Is a linked list suitable for polynomial manipulation?<\/strong><br \/>\n<strong>Ans:<\/strong> Polynomial manipulation can be represented using a linked list. This representation makes polynomial manipulation efficient. While representing a polynomial using a linked list, each polynomial term represents a node in the linked list.<\/p>\n<p><strong>Q3. What is the advantage of using a linked list for representing polynomials over an array?<\/strong><br \/>\n<strong>Ans:<\/strong> A few advantages of linked lists over arrays are :<\/p>\n<ul>\n<li>Dynamic size.<\/li>\n<li>Efficient implementation of data structures.<\/li>\n<li>No memory wastage.<\/li>\n<li>Efficient insertion and deletion operation.<\/li>\n<\/ul>\n<p><strong>Q4. How is a polynomial stored using a linked list?<\/strong><br \/>\n<strong>Ans:<\/strong> We store each polynomial as a singly linked list where each node stores the exponent and coefficient in the data part and a reference to the next node. Their sum is then stored in another linked list.<\/p>\n<p><strong>Q5. How efficient is polynomial multiplication using linked lists?<\/strong><br \/>\n<strong>Ans:<\/strong> Polynomial multiplication using linked lists is a relatively efficient method, with a time complexity of O(n^2), where n is the number of terms in the polynomials. However, other methods such as the Fast Fourier Transform algorithm can achieve a faster time complexity of O(n log n) for large polynomials.<\/p>\n<p><strong>Q6. Can polynomial multiplication using linked lists be used for real-world applications?<\/strong><br \/>\n<strong>Ans:<\/strong> Yes, polynomial multiplication using linked lists can be used for real-world applications such as signal processing, image processing, and cryptography, where polynomials are commonly used to represent signals, images, and encryption keys.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To perform polynomial multiplication in C, we can represent each polynomial as a linked list of nodes, each with a coefficient and an exponent. The exponent represents the degree. The polynomial multiplication using a linked list in c has two polynomials that are stored in two linked lists, and we must perform operations to obtain [&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-4684","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>How to multiply two polynomials using Linked List<\/title>\n<meta name=\"description\" content=\"Learn the most efficient way to multiply two polynomials using Linked List. Code Implementation of Multiplication of two polynomials in C, Java &amp; Python.\" \/>\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\/multiplication-of-two-polynomials-using-linked-list\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to multiply two polynomials using Linked List\" \/>\n<meta property=\"og:description\" content=\"Learn the most efficient way to multiply two polynomials using Linked List. Code Implementation of Multiplication of two polynomials in C, Java &amp; Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/\" \/>\n<meta property=\"og:site_name\" content=\"PrepBytes Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prepbytes0211\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-02T09:43:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-27T12:38:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644913628868-Learn%20the%20most%20efficient%20way%20to%20multiply%20two%20polynomials%20using%20Linked%20List._Artboard%202.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\/multiplication-of-two-polynomials-using-linked-list\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/\"},\"author\":{\"name\":\"Prepbytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\"},\"headline\":\"Multiplication of Two Polynomials using Linked List\",\"datePublished\":\"2021-09-02T09:43:24+00:00\",\"dateModified\":\"2023-07-27T12:38:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/\"},\"wordCount\":1077,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644913628868-Learn%20the%20most%20efficient%20way%20to%20multiply%20two%20polynomials%20using%20Linked%20List._Artboard%202.png\",\"articleSection\":[\"Linked list articles\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/\",\"name\":\"How to multiply two polynomials using Linked List\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644913628868-Learn%20the%20most%20efficient%20way%20to%20multiply%20two%20polynomials%20using%20Linked%20List._Artboard%202.png\",\"datePublished\":\"2021-09-02T09:43:24+00:00\",\"dateModified\":\"2023-07-27T12:38:40+00:00\",\"description\":\"Learn the most efficient way to multiply two polynomials using Linked List. Code Implementation of Multiplication of two polynomials in C, Java & Python.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644913628868-Learn%20the%20most%20efficient%20way%20to%20multiply%20two%20polynomials%20using%20Linked%20List._Artboard%202.png\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644913628868-Learn%20the%20most%20efficient%20way%20to%20multiply%20two%20polynomials%20using%20Linked%20List._Artboard%202.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-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\":\"Multiplication of Two Polynomials using 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":"How to multiply two polynomials using Linked List","description":"Learn the most efficient way to multiply two polynomials using Linked List. Code Implementation of Multiplication of two polynomials in C, Java & Python.","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\/multiplication-of-two-polynomials-using-linked-list\/","og_locale":"en_US","og_type":"article","og_title":"How to multiply two polynomials using Linked List","og_description":"Learn the most efficient way to multiply two polynomials using Linked List. Code Implementation of Multiplication of two polynomials in C, Java & Python.","og_url":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2021-09-02T09:43:24+00:00","article_modified_time":"2023-07-27T12:38:40+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644913628868-Learn%20the%20most%20efficient%20way%20to%20multiply%20two%20polynomials%20using%20Linked%20List._Artboard%202.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\/multiplication-of-two-polynomials-using-linked-list\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/"},"author":{"name":"Prepbytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e"},"headline":"Multiplication of Two Polynomials using Linked List","datePublished":"2021-09-02T09:43:24+00:00","dateModified":"2023-07-27T12:38:40+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/"},"wordCount":1077,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644913628868-Learn%20the%20most%20efficient%20way%20to%20multiply%20two%20polynomials%20using%20Linked%20List._Artboard%202.png","articleSection":["Linked list articles"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/","url":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/","name":"How to multiply two polynomials using Linked List","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644913628868-Learn%20the%20most%20efficient%20way%20to%20multiply%20two%20polynomials%20using%20Linked%20List._Artboard%202.png","datePublished":"2021-09-02T09:43:24+00:00","dateModified":"2023-07-27T12:38:40+00:00","description":"Learn the most efficient way to multiply two polynomials using Linked List. Code Implementation of Multiplication of two polynomials in C, Java & Python.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-linked-list\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644913628868-Learn%20the%20most%20efficient%20way%20to%20multiply%20two%20polynomials%20using%20Linked%20List._Artboard%202.png","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1644913628868-Learn%20the%20most%20efficient%20way%20to%20multiply%20two%20polynomials%20using%20Linked%20List._Artboard%202.png"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/multiplication-of-two-polynomials-using-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":"Multiplication of Two Polynomials using 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\/4684","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=4684"}],"version-history":[{"count":8,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/4684\/revisions"}],"predecessor-version":[{"id":17386,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/4684\/revisions\/17386"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=4684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=4684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=4684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}