Answered step by step
Verified Expert Solution
Link Copied!

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 image text in transcribedimage text in transcribed

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: 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago