SHARE
TWEET

Untitled

a guest Jan 21st, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static Poly diff (Poly p) throws NullPointerException {
  2.    //EFFECTS: If p is null throws NullPointerException
  3.    //    else returns the Poly obtained by differentiating p.
  4.    Poly q = new Poly ( );
  5.    for (int i = 1; i <= p.degree( ); i++)
  6.       q = q.add(new Poly(p.coeff(i)*i, i - 1));
  7.    return q;
  8. }
  9.  
  10. public static IntSet getElements (int[ ] a)
  11.       throws NullPointerException {
  12.    //EFFECTS: If a is null throws NullPointerException else returns a set
  13.   //  containing an entry for each distinct element of a.
  14.    IntSet s = new IntSet( );
  15.    for (int i = 0; i < a.length; i++) s.insert(a[i]);
  16.    return s;
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top