Abstract
Given a set of n weighted points on the x-y plane, we want to find a step function consisting of k horizontal steps such that the maximum vertical weighted distance from any point to a step is minimized. We solve this problem in O(n) time when k is a constant. Our approach relies on the prune-and-search technique, and can be adapted to design similar linear time algorithms to solve the line-constrained k-center problem and the size-k histogram construction problem as well.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
For the sake of simplicity we assume that no two points have the same x or y coordinate. But the results are valid if this assumption is removed.
- 2.
For two points p and q, if \(p.y\not =q.y\) and \(w(p)=w(q)\) hold then there is only one intersection. If \(p.y=q.y\), we can ignore one of the points with the smaller weight.
- 3.
We define U and L this way, because many points could lie on them.
- 4.
As before, we assume that the points have different y-coordinates. Either one is the big component.
- 5.
See Steps 6–8 of Algorithm 1-Step.
- 6.
Note that there may be more than two critical points in which case all but two are “useless.”
- 7.
Unless \(P^*_i =P_i\) for all i, such an i always exists.
- 8.
This could be done in \(O(n\log k)\) time.
References
Ajtai, M., Komlós, J., Szemerédi, E.: An \({O}(n \log n)\) sorting network. In: Proceedings of the 15th Annual ACM Symposium on Theory of Computing (STOC), pp. 1–9 (1983)
Bhattacharya, B., Shi, Q.: Optimal algorithms for the weighted p-center problems on the real line for small p. In: Dehne, F., Sack, J.-R., Zeh, N. (eds.) WADS 2007. LNCS, vol. 4619, pp. 529–540. Springer, Heidelberg (2007)
Bhattacharya, B., Das, S.: Prune-and-search technique in facility location. In: Proceedings of the 55th Conference on Canadian Operational Research Society (CORS), p. 76, May 2013
Chen, D.Z., Li, J., Wang, H.: Efficient algorithms for the one-dimensional \(k\)-center problem. Theor. Comput. Sci. 592, 135–142 (2015)
Chen, D.Z., Wang, H.: Approximating points by a piecewise linear function: I. In: Dong, Y., Du, D.-Z., Ibarra, O. (eds.) ISAAC 2009. LNCS, vol. 5878, pp. 224–233. Springer, Heidelberg (2009)
Cole, R.: Slowing down sorting networks to obtain faster sorting algorithms. J. ACM 34, 200–208 (1987)
Díaz-Báñez, J., Mesa, J.: Fitting rectilinear polygonal curves to a set of points in the plane. Eur. J. Oper. Res. 130, 214–222 (2001)
Fournier, H., Vigneron, A.: Fitting a step function to a point set. Algorithmica 60, 95–101 (2011)
Fournier, H., Vigneron, A.: A deterministic algorithm for fitting a step function to a weighted point-set. Inf. Process. Lett. 113, 51–54 (2013)
Frederickson, G.: Optimal algorithms for tree partitioning. In: Proceedings of the 2nd ACM-SIAM Symposium on Discrete Algorithms, pp. 168–177 (1991)
Frederickson, G., Johnson, D.: Generalized selection and ranking. 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 (STOC), pp. 135–143 (1984)
Guha, S., Shim, K.: A note on linear time algorithms for maximum error histograms. IEEE Trans. Knowl. Data Eng. 19, 993–997 (2007)
Karmakar, A., Das, S., Nandy, S.C., Bhattacharya, B.: Some variations on constrained minimum enclosing circle problem. J. Comb. Optim. 25(2), 176–190 (2013)
Liu, J.-Y.: A randomized algorithm for weighted approximation of points by a step function. In: Wu, W., Daescu, O. (eds.) COCOA 2010, Part I. LNCS, vol. 6508, pp. 300–308. Springer, Heidelberg (2010)
Lopez, M.A., 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)
Megiddo, N.: Applying parallel computation algorithms in the design of serial algorithms. J. ACM 30, 852–865 (1983)
Megiddo, N.: Linear-time algorithms for linear-programming in \({R}^3\) and related problems. SIAM J. Comput. 12, 759–776 (1983)
Wang, D.: A new algorithm for fitting a rectilinear \(x\)-monotone curve to a set of points in the plane. Pattern Recogn. Lett. 23, 329–334 (2002)
Wang, H., Zhang, J.: Line-constrained \(k\)-median, \(k\)-means, and \(k\)-center problems in the plane. In: Ahn, H.-K., Shin, C.-S. (eds.) ISAAC 2014. LNCS, vol. 8889, pp. 3–14. Springer, Heidelberg (2014)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2016 Springer International Publishing Switzerland
About this paper
Cite this paper
Bhattacharya, B., Das, S., Kameda, T. (2016). Linear-Time Fitting of a k-Step Function. In: Govindarajan, S., Maheshwari, A. (eds) Algorithms and Discrete Applied Mathematics. CALDAM 2016. Lecture Notes in Computer Science(), vol 9602. Springer, Cham. https://doi.org/10.1007/978-3-319-29221-2_8
Download citation
DOI: https://doi.org/10.1007/978-3-319-29221-2_8
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-29220-5
Online ISBN: 978-3-319-29221-2
eBook Packages: Computer ScienceComputer Science (R0)