Question: JAVA Data Structures LINKED LIST : Write JAVA code to create a Copy of Polynomial p /** Postcondition: Creates a copy of Polynomial p *

JAVA Data Structures LINKED LIST: Write JAVA code to create a Copy of Polynomial p /**Postcondition: Creates a copy of Polynomial p * @param p the Polynomial which is to be copied. * **/ public Polynomial(Polynomial p) { // write code here } 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Here is the class code (class Polynomial with a static nested TermNode class) I have already written:

public class Polynomial { private TermNode first; private static class TermNode { private double coefficient; private int exponent; private TermNode link; public TermNode(double coeff, int exp, TermNode linkTerm) { coefficient = coeff; exponent = exp; link = linkTerm; } } public Polynomial() { first = new TermNode(0,0, null); } public Polynomial(double a0) { first = new TermNode(a0,0,null); }

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!