Question: Hi! Please do not skip this. I need help in debugging my C program. We were tasked to do polynomial addition using linked list. I

Hi! Please do not skip this. I need help in debugging my C program.
We were tasked to do polynomial addition using linked list. I had to output the sum in canonical form so that means I had to sort my newlist.
However, there's currently an endless loop in my while(beta!=NULL) and I'm not sure what's wrong with my code.
The code is at https://pastebin.com/t10GmLDR
Thank you!
Hi! Please do not skip this. I need help in debugging my
C program. We were tasked to do polynomial addition using linked list.

For this machine exercise, your task is to implement the algorithm for polynomial addition using linear lists following the algorithms given in Sir Quiwa's book and also given here). Input Format We assume that our input is always a polynomial on three variables (x,y,z). Two polynomials are read from input. Each polynomial PP is represented as follows: 1. the first line denotes the number of non-zero terms PP 2. the succeeding lines represent every term in PP 3. Each line representing a term is composed of four values: the first three are non-negative integers (representing the exponents of x,y and z, respectively), the last term represents the coefficient. Note that the coefficient is a real number that may be signed or unsigned. Sample input is given below: 3 1 60 -7 070-6 7001 5 1 0 1 9 070-2 5 3 2 4 1 2 3 4 1 3 0 3 Output Format The output should show the polynomial resulting from adding the two input polynomials. The polynomial should be output in canonical form. Each term is given in a separate line. Each line representing a term follows the same format as in input (item (C) above). For the output, print the coefficient up to three decimal places. Sample output is given below: 700 1.000 5 3 2 4.000 1 60 -7.000 1 3 0 3.000 1 2 3 4.000 101 9.000 070 -8.000 For this machine exercise, your task is to implement the algorithm for polynomial addition using linear lists following the algorithms given in Sir Quiwa's book and also given here). Input Format We assume that our input is always a polynomial on three variables (x,y,z). Two polynomials are read from input. Each polynomial PP is represented as follows: 1. the first line denotes the number of non-zero terms PP 2. the succeeding lines represent every term in PP 3. Each line representing a term is composed of four values: the first three are non-negative integers (representing the exponents of x,y and z, respectively), the last term represents the coefficient. Note that the coefficient is a real number that may be signed or unsigned. Sample input is given below: 3 1 60 -7 070-6 7001 5 1 0 1 9 070-2 5 3 2 4 1 2 3 4 1 3 0 3 Output Format The output should show the polynomial resulting from adding the two input polynomials. The polynomial should be output in canonical form. Each term is given in a separate line. Each line representing a term follows the same format as in input (item (C) above). For the output, print the coefficient up to three decimal places. Sample output is given below: 700 1.000 5 3 2 4.000 1 60 -7.000 1 3 0 3.000 1 2 3 4.000 101 9.000 070 -8.000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!