Polynomials
Introduction / Definition
A polynomial can be represented as a list of coefficient-exponent terms. This is especially useful for sparse polynomials. Addition combines terms with equal exponents. Ordered lists make polynomial operations easier to implement.
Syntax / Structure / Formula
P(x)=Σ c_i x^{e_i}
Detailed Explanation
Store each term as (coefficient, exponent), usually sorted by exponent.
Example
P(x) = 5x^4 + 3x^2 + 7
Represented as: [(5, 4) -> (3, 2) -> (7, 0)]
Output / Result
Sparse terms with zero coefficients are omitted, saving memory.
Important Points / Notes
- Sort nodes in descending exponent order to enable linear O(N + M) addition.
- Multiplication takes O(N × M) using term distribution.
Mini Practice Question
How does a linked list save memory when representing P(x) = 10x^1000 + 4?
CheckpointTest Yourself