Fitting a Step Function to a Point Set

  • Hervé Fournier
  • Antoine Vigneron
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5193)


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 Θ(n logn) 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(n log4 n). Finally, we give an O(n h 2 logh) algorithm for the case where h outliers are allowed, and the input is sorted. The running time of all our algorithms is independent of k.


Decision Problem Step Function Time Algorithm Binary Search Decision Algorithm 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Agarwal, P.K., Har-Peled, S., Yu, H.: Robust shape fitting via peeling and grating coresets. In: Proc. 17th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 182–191 (2006)Google Scholar
  2. 2.
    Agarwal, P.K., Sharir, M.: Efficient algorithms for geometric optimization. Computing Surveys 30 (1998)Google Scholar
  3. 3.
    Atanassov, R., Bose, P., Couture, M., Maheshwari, A., Morin, P., Paquette, M., Smid, M., Wuhrer, S.: Algorithms for optimal outlier removal. Journal of Discrete Algorithms (to appear)Google Scholar
  4. 4.
    Buragohain, C., Shrivastava, N., Suri, S.: Space efficient streaming algorithms for the maximum error histogram. In: 23rd International Conference on Data Engineering, pp. 1026–1035 (2007)Google Scholar
  5. 5.
    Chazal, F., Das, S.: An efficient algorithm for fitting rectilinear x - monotone curve to a point set in a plane. Technical report (August 2006),
  6. 6.
    Frederickson, G.N.: Optimal algorithms for tree partitioning. In: Proc. 2nd Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 168–177 (1991)Google Scholar
  7. 7.
    Frederickson, G.N., Johnson, D.B.: Generalized selection and ranking: Sorted matrices. SIAM Journal on Computing 13(1), 14–30 (1984)zbMATHCrossRefMathSciNetGoogle Scholar
  8. 8.
    Gabow, H.N., Bentley, J.L., Tarjan, R.E.: Scaling and related techniques for geometry problems. In: Proc. 16th Annual ACM Symposium on Theory of Computing, pp. 135–143 (1984)Google Scholar
  9. 9.
    Goodrich, M.T.: Efficient piecewise-linear function approximation using the uniform metric. Discrete and Computational Geometry 14(4), 445–462 (1995)zbMATHMathSciNetGoogle Scholar
  10. 10.
    Guha, S., Shim, K.: A note on linear time algorithms for maximum error histograms. IEEE Transactions on Knowledge and Data Engineering 19(7), 993–997 (2007)CrossRefGoogle Scholar
  11. 11.
    Har-Peled, S., Wang, Y.: Shape fitting with outliers. SIAM Journal on Computing 33(2), 269–285 (2004)zbMATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestors. SIAM Journal on Computing 13(2), 338–355 (1984)zbMATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    Ioannidis, Y., Poosala, V.: Histogram-based solutions to diverse database estimation problems. IEEE Data Eng. Bull. 18(3), 10–18 (1995)Google Scholar
  14. 14.
    Karras, P., Sacharidis, D., Mamoulis, N.: Exploiting duality in summarization with deterministic guarantees. In: 13th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 380–389 (2007)Google Scholar
  15. 15.
    Lopez, M., Mayster, Y.: Weighted rectilinear approximation of points in the plane. In: Laber, E.S., Bornstein, C., Nogueira, L.T., Faria, L. (eds.) LATIN 2008. LNCS, vol. 4957, pp. 642–653. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  16. 16.
    Mayster, Y., Lopez, M.A.: Approximating a set of points by a step function. Journal of Visual Comunication and Image Represententation 17(6), 1178–1189 (2006)CrossRefGoogle Scholar
  17. 17.
    Díaz-Báñez, J.M., Mesa, J.A.: Fitting rectilinear polygonal curves to a set of points in the plane. European Journal of Operational Research 130(1), 214–222 (2001)zbMATHCrossRefMathSciNetGoogle Scholar
  18. 18.
    Wang, D.P.: A new algorithm for fitting a rectilinear x-monotone curve to a set of points in the plane. Pattern Recognition Letters 23(1-3), 329–334 (2002)zbMATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Hervé Fournier
    • 1
  • Antoine Vigneron
    • 2
  1. 1.Laboratoire PRiSM, CNRS UMR 8144 and Université de Versailles St-Quentin en YvelinesVersaillesFrance
  2. 2.INRA, UR 341 Mathématiques et Informatique AppliquéesJouy-en-JosasFrance

Personalised recommendations