PolynomialSortedList

PolynomialSortedList - package comp202 public class...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
package comp202; public class PolynomialSortedList implements Polynomial { private static class PolyNode { private PolyNode next; private int coefficient; private int exponent; public PolyNode(int co, int ex) { coefficient=co; exponent=ex; next=null; } public PolyNode(int co, int ex,PolyNode n) { coefficient=co; exponent=ex; next=n; } public PolyNode getNext() { return next; } public void setNext(PolyNode next) { this.next = next; } public int getCoefficient() { return coefficient; } public void setCoefficient(int coefficient) { this.coefficient = coefficient; } public int getExponent() { return exponent; } public void setExponent(int exponent) { this.exponent = exponent; } } private PolyNode poly; public PolynomialSortedList() { poly=null; } public PolynomialSortedList(int c, int exp) { poly=new PolyNode(c,exp); } public PolynomialSortedList(int c[], int exp[]) {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
poly=new PolyNode(c[0],exp[0]); PolyNode current=poly; for(int i=1;i<exp.length;i++) { PolyNode newest=new PolyNode(c[i],exp[i]);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/13/2011 for the course ENGR 202 taught by Professor Yavuzyildirim during the Spring '11 term at Boğaziçi University.

Page1 / 5

PolynomialSortedList - package comp202 public class...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online