Initial Basics – Algebra – Problem #2
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Problem Statement
Consider the polynomials f(x) and g(x) from the first part of the assignment. Read 3 unique integers modulo p and evaluate f(x) and g(x) on those points. If 3 integers are not unique, print an error message and exit. Let {α1, α2, α3} be those points, then the evaluation should give us {f(α1), f(α2), f(α3)} and {g(α1), g(α2), g(α3)}. Add them point-wise to obtain: {f(α1) + g(α1), f(α2) + g(α2), f(α3) + g(α3)}. Define polynomial m(x) in the point-value representation as: {{α1, m(α1)}, {α2, m(α2)}, {α3, m(α3)}} := {{α1, f(α1) + g(α1)}, {α2, f(α2) + g(α2)}, {α3, f(α3) + g(α3)}}. Print f(x), g(x), and m(x) using point-value representation.