Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Polynomial Polynomial::operator * ( int scale ) const { if ( degree = = - 1 ) return Polynomial ( ) ; Polynomial result (

Polynomial Polynomial::operator*(int scale) const
{
if (degree ==-1)
return Polynomial();
Polynomial result (*this);
for (int i =0; i <= degree; ++i)
result.coefficients[i]= scale * coefficients[i];
result.normalize();
return result;
}
Polynomial Polynomial::operator*(Term term) const
{
if (degree ==-1)
return Polynomial();
int* results = new int[degree +1+ term.power];
for (int i =0; i < term.power; ++i)
results[i]=0;
for (int i =0; i < degree +1; ++i)
results[i+term.power]= coefficients[i]* term.coefficient;
Polynomial result (degree +1+ term.power, results);
delete [] results;
return result;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are the general effects of import restrictions on trade?

Answered: 1 week ago

Question

What is meant by organisational theory ?

Answered: 1 week ago

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago