0

I need this method to return the simplified polynomial for example: if the result is 3.00x^4 + 6.00x^2 + 2.00x^3 + 4.00x+x^2 + 2.00 i need it to return it simplified to 3.00x^4 + 2.00x^3 + 7.00x^2 + 4.00x + 2.00

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Nicky
  • 1

1 Answers1

1

One way to do this is to use an integer array. The coefficient of xn goes in the nth place of the array. And as you add it to the list, you'll add the number to whatever is there. Integer arrays have 0 in every position by default.

This would add polynomials for you.

Abra
  • 19,142
  • 7
  • 29
  • 41
Gama
  • 141
  • 4