Algorithm: Give an algorithm that takes a sequence of points in the plane (x1, y1), (x2, y2), ...., (xn, yn) and an integer k as input and returns the best piecewise linear function f consisting of at most k pieces that minimizes the sum squared error.
You may suppose that you have access to an algorithm that computes the sum squared error for one segment through a set of n points in O(n) time.
Your solution should use \(O(n^2k)\) time and \(O(nk)\) space. Please keep it simple and short and no copy and paste or at least help me get started?