Algorithm for polynomial addition using linked list
Answers
Answered by
1
Given two polynomial numbers represented by a linked list. Write a function that add these lists means add the coefficients who have same variable powers.
Example:
Input: 1st number = 5x^2 + 4x^1 + 2x^02nd number = 5x^1 + 5x^0
Output: 5x^2 + 9x^1 + 7x^0
Input: 1st number = 5x^3 + 4x^2 + 2x^0
2nd number = 5x^1 + 5x^0
Output: 5x^3 + 4x^2 + 5x^1 + 7x^0
Hope it helps =)
Thanks (^^)
Similar questions