Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In PYTHON Please: Polynomials and Linked lists Polynomial class You are to implement a Polynomial class that supports an integer polynomial datatype. Quite often, such
In PYTHON Please: Polynomials and Linked lists
Polynomial class
You are to implement a Polynomial class that supports an integer polynomial datatype. Quite often, such a datatype can be implemented using a list or an array. However, our Polynomials will be sparse, meaning that a lot of terms will be zero. In such a case, only the nonzero terms should be stored in the data structure. For this assignment, you must use a linked list to store the nonzero terms of the polynomial.
Your solution must adhere to the following specification:
Polynomials can be created with an optional list of tuples where a tuple represents a coefficient exponent pair.
For example, Polynomial represents Any combination of tuples can be used to represent a polynomial. Exponents can appear more than once, and coefficients can be zero. You must collect like terms and remove all terms that are zero. Terms must be stored in descending order of exponent. Polynomials must be stored in a unique or canonical form. Polynomial with no argument creates a zero polynomial
The Polynomial class must implement a method that returns a string representation of a Polynomial object so that it can be printed. A polynomial must be printed in its stored canonical form, ie in descending order of exponent with no zero terms or coefficients of For the zero polynomial, this method should return
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started