Fitting a Step Function to a Point Set

  • Authors:
  • Hervé Fournier;Antoine Vigneron

  • Affiliations:
  • Université de Versailles Saint-Quentin-en-Yvelines, Laboratoire PRiSM, CNRS UMR 8144, 45 avenue des États-Unis, 78035, Versailles, France;INRA, UR 341 Mathématiques et Informatique Appliquées, 78350, Jouy-en-Josas, France

  • Venue:
  • Algorithmica - Special Issue: European Symposium on Algorithms
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

We consider the problem of fitting a step function to a set of points. More precisely, given an integer k and a set P of n points in the plane, our goal is to find a step function f with k steps that minimizes the maximum vertical distance between f and all the points in P. We first give an optimal Θ(nlog n) algorithm for the general case. In the special case where the points in P are given in sorted order according to their x-coordinates, we give an optimal Θ(n) time algorithm. Then, we show how to solve the weighted version of this problem in time O(nlog 4 n). Finally, we give an O(nh 2log n) algorithm for the case where h outliers are allowed. The running time of all our algorithms is independent of k.