Question: In java, i have provided the code to go along with it class PolynomialLinkedList{ private static class PNode{ private int coe; private int exp; private

In java, i have provided the code to go along with it

In java, i have provided the code to go along with it

class PolynomialLinkedList{ private static class PNode{ private int coe; private int exp; private PNode next; public PNode(int c, int e){ this(c, e, null); } public PNode(int c, int e, PNode n){ coe = c; exp = e; next = n; } public void setCoe(int c){ coe = c;} public void setExp(int e){ exp = e;} public void setNext(PNode n){ next = n;} public int getCoe(){ return coe;} public int getExp(){ return exp;} public PNode getNext(){ return next;} } private PNode first; private PNode last; public PolynomialLinkedList(){ first = last = null; } public PolynomialLinkedList(int c, int e){ PNode tempn = new PNode(c, e); first = last = tempn; } public void print(){ if (first == null){ System.out.println(); return; } PNode temp = first; String ans = ""; while (temp != null){ if (temp.getCoe() > 0) { if (temp != first) ans = ans + " + "; ans = ans + temp.getCoe(); } else if (temp.getCoe()  

class PolynomialLinkedList{ private static class PNode{ private int coe; private int exp;

3. Implement Polynomial Linked List add method which adds two polynomials in standard form and returns sum polynomial which also has to be in standard form. Rewrite the instance method by merging the caller and parameter Polynomial Linked List into another sum Polynomial. Both caller and parameter Polynomials are expected to be in standard form, the method should return the sum Polynomial also in standard form. A standard form polynomial has no duplicate terms (each term's exponent is unique) and the exponent is in descending order. This method should be O(n), n as the number of terms in the sum polynomial. 3. Implement Polynomial Linked List add method which adds two polynomials in standard form and returns sum polynomial which also has to be in standard form. Rewrite the instance method by merging the caller and parameter Polynomial Linked List into another sum Polynomial. Both caller and parameter Polynomials are expected to be in standard form, the method should return the sum Polynomial also in standard form. A standard form polynomial has no duplicate terms (each term's exponent is unique) and the exponent is in descending order. This method should be O(n), n as the number of terms in the sum polynomial

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!