Skip to main content

An empirical estimation for time and memory algorithm complexities: newly developed R package

Abstract

When an algorithm or a program runs on a computer, it requires some resources. The complexity of an algorithm is the measure of the resources, for some input. These complexities are usually space and time. The subject of the empirical computational complexity has been studied in the research. This article introduces GuessCompx which is an R package that performs an empirical estimation on the time and memory complexities of an algorithm or a function, and provides a reliable, convenient and simple procedure for estimation process. It tests multiple increasing-sizes samples of the user’s data and attempts to fit one of seven complexity functions: O(N), O(Nˆ2), O(log(N)), etc. In addition, based on the best fit procedure using leave one out-mean squared error (LOO-MSE), it predicts the full computation time and memory usage on the whole dataset. Together with this results, a plot and a significance test are returned. Complexity is assessed with regard to the user’s actual dataset through its size (and no other parameter). This article provides several examples demonstrating several cases (e.g., distance function, time series and custom function) and optimal parameters tuning.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8

References

  1. Abualigah LMQ (2019) Feature selection and enhanced krill herd algorithm for text document clustering. Springer, Berlin

    Book  Google Scholar 

  2. Abualigah L (2020) Multi-verse optimizer algorithm: a comprehensive survey of its results, variants, and applications. Neural Comput Appl 1–21

  3. Abualigah LM, Khader AT (2017) Unsupervised text feature selection technique based on hybrid particle swarm optimization algorithm with genetic operators for the text clustering. J Supercomput 73(11):4773–4795

    Article  Google Scholar 

  4. Abualigah LM, Khader AT, Hanandeh ES (2018) A new feature selection method to improve the document clustering using particle swarm optimization algorithm. J Comput Sci 25:456–466

    Article  Google Scholar 

  5. Agenis M (2019) Guesscompx. https://github.com/agenis/GuessCompx

  6. Agenis M (2019) Guesscompxperformancetests. https://github.com/agenis/GuessCompxPerformanceTests

  7. Agenis M, Bokde N (2019) GuessCompx: empirically estimates algorithm complexity. R package version 1.0.3. [Online]. Available: https://CRAN.R-project.org/package=GuessCompx

  8. Anderson J, Mohan S (1984) Sequential coding algorithms: a survey and cost analysis. IEEE Trans Commun 32(2):169–176

    Article  Google Scholar 

  9. Bournez O, Pouly A (2018) A survey on analog models of computation. arXiv preprint arXiv:1805.05729

  10. Chivers I, Sleightholme J (2015) An introduction to algorithms and the big o notation. In: Introduction to programming with fortran. Springer, Berlin, pp 359–364

  11. Contributors W (2019) Time complexity—Wikipedia, the free encyclopedia, online; accessed 01 May 2019. [Online]. Available: https://en.wikipedia.org/wiki/Time_complexity

  12. Dong Y, Zhang Z, Hong W-C (2018) A hybrid seasonal mechanism with a chaotic cuckoo search algorithm with a support vector regression model for electric load forecasting. Energies 11(4):1009

    Article  Google Scholar 

  13. Goldsmith SF, Aiken AS, Wilkerson DS (2007) Measuring empirical computational complexity. In: Proceedings of the the 6th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering. ACM, pp 395–404

  14. He J, Yao X (2001) Drift analysis and average time complexity of evolutionary algorithms. Artif Intell 127(1):57–85

    MathSciNet  Article  Google Scholar 

  15. Hong W-C, Dong Y, Lai C-Y, Chen L-Y, Wei S-Y (2011) Svr with hybrid chaotic immune algorithm for seasonal load demand forecasting. Energies 4(6):960–977

    Article  Google Scholar 

  16. Hong W-C, Li M-W, Geng J, Zhang Y (2019) Novel chaotic bat algorithm for forecasting complex motion of floating platforms. Appl Math Model 72:425–443

    MathSciNet  Article  Google Scholar 

  17. Jensen MT (2003) Reducing the run-time complexity of multiobjective eas: the nsga-ii and other algorithms. IEEE Trans Evol Comput 7(5):503–515

    Article  Google Scholar 

  18. Kundra H, Sadawarti H (2015) Hybrid algorithm of cuckoo search and particle swarm optimization for natural terrain feature extraction. Res J Inf Technol 7(1):58–69

    Google Scholar 

  19. Min W (2010) Analysis on bubble sort algorithm optimization. In: International forum on information technology and applications, vol 1. IEEE, pp 208–211

  20. Min W (2010) Analysis on bubble sort algorithm optimization. In: 2010 International forum on information technology and applications, vol 1. IEEE, pp 208–211

  21. Paliwal V, Ghare AD, Mirajkar AB, Bokde ND, Feijoo Lorenzo AE (2020) Computer modeling for the operation optimization of mula reservoir, upper Godavari Basin, India, using the Jaya algorithm. Sustainability 12(1):84

    Article  Google Scholar 

  22. Pégny M (2013) Computational complexity: an empirical view. In: 39th Annual convention of the society for the study of artificial intelligence and the simulation of behaviour (AISB 2013), pp 1–6

  23. Pégny M (2016) How to make a meaningful comparison of models: the church–turing thesis over the reals. Mind Mach 26(4):359–388

    Article  Google Scholar 

  24. Qiu J, Wu Q, Ding G, Xu Y, Feng S (2016) A survey of machine learning for big data processing. EURASIP J Adv Signal Process 2016(1):67

    Article  Google Scholar 

  25. Salih SQ, Alsewari AA (2020) A new algorithm for normal and large-scale optimization problems: nomadic people optimizer. Neural Comput Appl 32(14), 10359–10386

  26. Shapiro JF (1979) Mathematical programming: structures and algorithms. Tech Rep.

  27. Sharma DK, Vohra S, Gupta T, Goyal V (2018) Predicting the algorithmic time complexity of single parametric algorithms using multiclass classification with gradient boosted trees. In: 2018 Eleventh international conference on contemporary computing (IC3). IEEE, pp 1–6

  28. Valiant LG (1979) The complexity of computing the permanent. Theor Comput Sci 8(2):189–201

    MathSciNet  Article  Google Scholar 

  29. Woeginger GJ (2004) Space and time complexity of exact algorithms: some open problems. In: International workshop on parameterized and exact computation. Springer, pp 281–290

  30. Wong IC, Shen Z, Evans BL, Andrews JG (2004) A low complexity algorithm for proportional resource allocation in ofdma systems. In: IEEE workshop on signal processing systems. IEEE, pp 1–6

  31. Yang Y, Yu P, Gan Y (2011) Experimental study on the five sort algorithms. In: 2011 Second international conference on mechanic automation and control engineering. IEEE, pp 1314–1317

  32. Zhang Z, Hong W-C (2019) Electric load forecasting by complete ensemble empirical mode decomposition adaptive noise and support vector regression with quantum-based dragonfly algorithm. Nonlinear Dyn 98(2):1107–1136

    Article  Google Scholar 

  33. Zhang Z, Hong W-C, Li J (2020) Electric load forecasting by hybrid self-recurrent support vector regression model with variational mode decomposition and improved cuckoo search algorithm. IEEE Access 8:14642–14658

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Zaher Mundher Yaseen.

Additional information

Publisher’s note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Agenis-Nevers, M., Bokde, N.D., Yaseen, Z.M. et al. An empirical estimation for time and memory algorithm complexities: newly developed R package. Multimed Tools Appl 80, 2997–3015 (2021). https://doi.org/10.1007/s11042-020-09471-8

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11042-020-09471-8

Keywords

  • Time complexity
  • Memory complexity
  • Empirical approach
  • R package
  • Algorithm complexity