Algorithm
Addition of Two Polynomials Using Linked List:
- Define a Node structure with fields for coefficient, exponent, and a pointer to the next node.
- Create two linked lists to represent the input polynomials.
- Initialize a new linked list to store the result polynomial.
- Set pointers to the head of both input linked lists.
- While neither linked list is fully traversed:
- Compare the exponents of the current nodes from both linked lists.
- If the exponents are equal:
- Add the coefficients of the nodes.
- Create a new node with the sum of coefficients and the common exponent.
- Append the new node to the result linked list.
- Move both pointers to the next node.
- If the exponent of the first polynomial is greater:
- Create a new node with the coefficient and exponent of the current node from the first polynomial.
- Append the new node to the result linked list.
- Move the pointer of the first polynomial to the next node.
- If the exponent of the second polynomial is greater:
- Create a new node with the coefficient and exponent of the current node from the second polynomial.
- Append the new node to the result linked list.
- Move the pointer of the second polynomial to the next node.
- Copy any remaining nodes from either linked list into the result linked list.
- Return the head of the result linked list.
Example:

Fig. 1: Example of Adding Two Polynomials Using Linked List
Note: Ensure that the polynomials are sorted by descending exponents before performing the addition.