Would someone please give some idea about writing a program on adding two polyno
ID: 3792710 • Letter: W
Question
Would someone please give some idea about writing a program on adding two polynomials as an ordered list of terms, where the terms are ordered by their exponents. In C++
Technical Requirements
• Use linked lists to keep track of the polynomials.
• Use iterators to iterate through the lists.
• Ask the user enter the polynomials in a user-friendly fashion. The polynomials should be entered as: 3X^3 – 1X^2 + 1 (You may assume there is only one variable (X) and there are no spaces).
• A polynomial is a list (linked list) of terms.
• The coefficients and powers can be more than one digit.
Explanation / Answer
The problem is much simpler when you to just add two polynomial using linked list
using struct node of this type will help you to store the coefficient and exponent of a polynomial. and also it is mentioned that only one variable of X is there. so using this sequence of the struct you can extract the polynomial.
now you traverse the list and simply add their coefficient if exponent matches as they are ordered.here is the code to get you idea.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.