Question: JAVA Data Structures LINKED LIST: Write JAVA code to create a Copy of Polynomial p /**Postcondition: Creates a copy of Polynomial p * @param 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
Get step-by-step solutions from verified subject matter experts
