Skip to main content

Linear-Time Fitting of a k-Step Function

  • Conference paper
Algorithms and Discrete Applied Mathematics (CALDAM 2016)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9602))

Included in the following conference series:

  • 1353 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 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. 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. 3.

    We define U and L this way, because many points could lie on them.

  4. 4.

    As before, we assume that the points have different y-coordinates. Either one is the big component.

  5. 5.

    See Steps 6–8 of Algorithm 1-Step.

  6. 6.

    Note that there may be more than two critical points in which case all but two are “useless.”

  7. 7.

    Unless \(P^*_i =P_i\) for all i, such an i always exists.

  8. 8.

    This could be done in \(O(n\log k)\) time.

References

  1. 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)

    Google Scholar 

  2. 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)

    Chapter  Google Scholar 

  3. 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

    Google Scholar 

  4. Chen, D.Z., Li, J., Wang, H.: Efficient algorithms for the one-dimensional \(k\)-center problem. Theor. Comput. Sci. 592, 135–142 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  5. 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)

    Chapter  Google Scholar 

  6. Cole, R.: Slowing down sorting networks to obtain faster sorting algorithms. J. ACM 34, 200–208 (1987)

    Article  MathSciNet  Google Scholar 

  7. 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)

    Article  MathSciNet  MATH  Google Scholar 

  8. Fournier, H., Vigneron, A.: Fitting a step function to a point set. Algorithmica 60, 95–101 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  9. Fournier, H., Vigneron, A.: A deterministic algorithm for fitting a step function to a weighted point-set. Inf. Process. Lett. 113, 51–54 (2013)

    Article  MathSciNet  MATH  Google Scholar 

  10. Frederickson, G.: Optimal algorithms for tree partitioning. In: Proceedings of the 2nd ACM-SIAM Symposium on Discrete Algorithms, pp. 168–177 (1991)

    Google Scholar 

  11. Frederickson, G., Johnson, D.: Generalized selection and ranking. SIAM J. Comput. 13(1), 14–30 (1984)

    Article  MathSciNet  MATH  Google Scholar 

  12. 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)

    Google Scholar 

  13. Guha, S., Shim, K.: A note on linear time algorithms for maximum error histograms. IEEE Trans. Knowl. Data Eng. 19, 993–997 (2007)

    Article  Google Scholar 

  14. 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)

    Article  MathSciNet  MATH  Google Scholar 

  15. 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)

    Chapter  Google Scholar 

  16. 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)

    Chapter  Google Scholar 

  17. Megiddo, N.: Applying parallel computation algorithms in the design of serial algorithms. J. ACM 30, 852–865 (1983)

    Article  MathSciNet  MATH  Google Scholar 

  18. Megiddo, N.: Linear-time algorithms for linear-programming in \({R}^3\) and related problems. SIAM J. Comput. 12, 759–776 (1983)

    Article  MathSciNet  MATH  Google Scholar 

  19. 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)

    Article  MATH  Google Scholar 

  20. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Tsunehiko Kameda .

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics