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.
Similar content being viewed by others
References
Agarwal, P., Har-Peled, S., Yu, H.: Robust shape fitting via peeling and grating coresets. In: Proceedings of the 17th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 182–191 (2006)
Agarwal, P., Sharir, M.: Efficient algorithms for geometric optimization. Comput. Surv. 30 (1998)
Aggarwal, A., Schieber, B., Tokuyama, T.: Finding a minimum-weight k-link path in graphs with the concave Monge property and applications. Discrete Comput. Geom. 12, 263–280 (1994)
Atanassov, R., Bose, P., Couture, M., Maheshwari, A., Morin, P., Paquette, M., Smid, M., Wuhrer, S.: Algorithms for optimal outlier removal. J. Discrete Algorithms 2(7), 239–248 (2009)
Ben-Or, M.: Lower bounds for algebraic computation trees. In: Proceedings of the 15th Annual ACM Symposium on Theory of Computing, pp. 80–86 (1983)
Bender, M., Farach-Colton, M.: The LCA problem revisited. In: Proceedings of the LATIN 2000: Theoretical Informatics, 4th Latin American Symposium, pp. 88–94 (2000)
Buragohain, C., Shrivastava, N., Suri, S.: Space efficient streaming algorithms for the maximum error histogram. In: Proceedings of the 23rd International Conference on Data Engineering, pp. 1026–1035 (2007)
Bürgisser, P., Clausen, M., Shokrollahi, M.: Algebraic Complexity Theory. Springer, Berlin (1997)
Frederickson, G.: Optimal algorithms for tree partitioning. In: Proceedings of the 2nd Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 168–177 (1991)
Frederickson, G., Johnson, D.: Generalized selection and ranking: Sorted matrices. SIAM J. Comput. 13(1), 14–30 (1984)
Gabow, H., Bentley, J., Tarjan, R.: Scaling and related techniques for geometry problems. In: Proceedings of the 16th Annual ACM Symposium on Theory of Computing, pp. 135–143 (1984)
Goodrich, M.: Efficient piecewise-linear function approximation using the uniform metric. Discrete Comput. Geom. 14(4), 445–462 (1995)
Guha, S., Shim, K.: A note on linear time algorithms for maximum error histograms. IEEE Trans. Knowl. Data Eng. 19(7), 993–997 (2007)
Har-Peled, S., Wang, Y.: Shape fitting with outliers. SIAM J. Comput. 33(2), 269–285 (2004)
Harel, D., Tarjan, R.: Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13(2), 338–355 (1984)
Ioannidis, Y., Poosala, V.: Histogram-based solutions to diverse database estimation problems. IEEE Data Eng. Bull. 18(3), 10–18 (1995)
Karras, P., Sacharidis, D., Mamoulis, N.: Exploiting duality in summarization with deterministic guarantees. In: Proceedings of the 13th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 380–389 (2007)
Lopez, M., Mayster, Y.: Weighted rectilinear approximation of points in the plane. In: Proceedings of the LATIN 2008: Theoretical Informatics, 7th Latin American Symposium. Lecture Notes in Computer Science, vol. 4957, pp. 642–653. Springer, Berlin (2008)
Mayster, Y., Lopez, M.A.: Approximating a set of points by a step function. J. Vis. Commun. Image Represent. 17(6), 1178–1189 (2006)
Díaz-Báñez, J., Mesa, J.: Fitting rectilinear polygonal curves to a set of points in the plane. Eur. J. Oper. Res. 130(1), 214–222 (2001)
Wang, D.: A new algorithm for fitting a rectilinear x-monotone curve to a set of points in the plane. Pattern Recognit. Lett. 23(1–3), 329–334 (2002)
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Fournier, H., Vigneron, A. Fitting a Step Function to a Point Set. Algorithmica 60, 95–109 (2011). https://doi.org/10.1007/s00453-009-9342-z
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-009-9342-z