Answered step by step
Verified Expert Solution
Question
1 Approved Answer
WRite the code in c language Using linked list, write a C program to evaluate polynomials: P1(x), P2(x), and P3(x) where P1(x) and P2(x) are
WRite the code in c language
Using linked list, write a C program to evaluate polynomials: P1(x), P2(x), and P3(x) where P1(x) and P2(x) are input polynomials and P3(x) is obtained by merging P1(x) and P2(x) in such a manner that the total number of terms in P3(x) is equal to the sum of the number of terms in P1(x) and P2(x) and the highest degree of P3(x) is the smallest integer greater than the sum of the highest degrees of P1(x) and P2(x). Rest of the terms are adjusted accordingly. For example, P1(x) = anxN + a(n-1) (N-1) + ... + aox and P2(x) = bmxM + b(M1;2(M1) +...+box then P3(x) is obtained as P3(x) = anx(N+M+1) +0(n-1)=(N=1+M+1) + ...+00x(M+1) +burM +b(M 13.0(M-1) + ... + box. Each node in the linked list correspond to + a term in the polynomial. So, in your node structure - you may keep two data components integers pow and coeff; and one pointer to the next node. Input Format: First line mentions K i.e. the number of test cases. Then there are three lines for each test case, In the first two lines of a test case, First number indicate the highest degree of polynomials N and then there are N+1 integers which are the coefficients of polynomial terms in descending order. In the third (and last line) of a test case, there is one integer i.e. value of x for which you need to evaluate the polynomials. (Constraints: 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started