Given two polynomials in the form of linked list. The task is to find the multiplication of both polynomials.
Input: Poly1: 3x^2 + 5x^1 + 6, Poly2: 6x^1 + 8 Output: 18x^3 + 54x^2 + 76x^1 + 48 On multiplying each element of 1st polynomial with elements of 2nd polynomial, we get 18x^3 + 24x^2 + 30x^2 + 40x^1 + 36x^1 + 48 On adding values with same power of x, 18x^3 + 54x^2 + 76x^1 + 48 Input: Poly1: 3x^3 + 6x^1 + 9, Poly2: 9x^3 + 8x^2 + 7x^1 + 2 Output: 27x^6 + 24x^5 + 75x^4 + 135x^3 + 114x^2 + 75x^1 + 18
- In this approach we will multiply the 2nd polynomial with each term of 1st polynomial.
- Store the multiplied value in a new linked list.
- Then we will add the coefficients of elements having the same power in resultant polynomial.
Below is the implementation of the above approach:
1st Polynomial:- 3x^2 + 5x^1 + 6 2nd Polynomial:- 6x^1 + 8 Resultant Polynomial:- 18x^3 + 54x^2 + 76x^1 + 48
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Adding two polynomials using Linked List using map
- Adding two polynomials using Linked List
- Multiply two polynomials
- Program to add two polynomials
- Create new linked list from two given linked list with greater element at each node
- XOR Linked List - A Memory Efficient Doubly Linked List | Set 1
- XOR Linked List – A Memory Efficient Doubly Linked List | Set 2
- Merge a linked list into another linked list at alternate positions
- Check if a linked list is Circular Linked List
- Convert singly linked list into circular linked list
- Difference between Singly linked list and Doubly linked list
- Convert Singly Linked List to XOR Linked List
- Construct a Maximum Sum Linked List out of two Sorted Linked Lists having some Common nodes
- Create a linked list from two linked lists by choosing max element at each position
- Length of longest palindrome list in a linked list using O(1) extra space
- Construct a Doubly linked linked list from 2D Matrix
- Exponential Squaring (Fast Modulo Multiplication)
- Python program for multiplication and division of complex number
- Multiplication table till N rows where every Kth row is table of K upto Kth term
- Sublist Search (Search a linked list in another list)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.