Abstract
When algorithms for sorting and searching are applied to keys that are represented as bit strings, we can quantify the performance of the algorithms not only in terms of the number of key comparisons required by the algorithms but also in terms of the number of bit comparisons. Some of the standard sorting and searching algorithms have been analyzed with respect to key comparisons but not with respect to bit comparisons. In this paper, we investigate the expected number of bit comparisons required by Quickselect (also known as Find). We develop exact and asymptotic formulae for the expected number of bit comparisons required to find the smallest or largest key by Quickselect and show that the expectation is asymptotically linear with respect to the number of keys. Similar results are obtained for the average case. For finding keys of arbitrary rank, we derive an exact formula for the expected number of bit comparisons that (using rational arithmetic) requires only finite summation (rather than such operations as numerical integration) and use it to compute the expectation for each target rank.
Similar content being viewed by others
References
Devroye, L.: On the probablistic worst-case time of “Find”. Algorithmica 31, 291–303 (2001)
Fill, J.A., Janson, S.: Quicksort asymptotics. J. Algorithms 44, 4–28 (2002)
Fill, J.A., Janson, S.: The number of bit comparisons used by Quicksort: An average-case analysis. In: Proceedings of the ACM-SIAM Symposium on Discrete Algorithms, pp. 293–300 (2004)
Flajolet, P., Grabner, P., Kirschenhofer, P., Prodinger, H., Tichy, R.F.: Mellin transforms and asymptotics: digital sums. Theor. Comput. Sci. 123, 291–314 (1994)
Flajolet, P., Sedgewick, R.: Mellin transforms and asymptotics: Finite differences and Rice’s integrals. Theor. Comput. Sci. 144, 101–124 (1995)
Grabner, P.J., Prodinger, H.: On a constant arising in the analysis of bit comparisons in Quickselect. Quaest. Math. 31, 303–306 (2008)
Grübel, R., Rösler, U.: Asymptotic distribution theory for Hoare’s selection algorithm. Adv. Appl. Probab. 28, 252–269 (1996)
Hoare, C.R.: Find (algorithm 65). Commun. ACM 4, 321–322 (1961)
Hwang, H., Tsai, T.: Quickselect and the Dickman function. Comb. Probab. Comput. 11, 353–371 (2002)
Knessl, C., Szpankowski, W.: Quicksort algorithm again revisited. Discrete Math. Theor. Comput. Sci. 3, 43–64 (1999)
Knuth, D.E.: Mathematical analysis of algorithms. In: Information Processing 71, Proceedings of IFIP Congress, Ljubljana, 1971, pp. 19–27. North-Holland, Amsterdam (1972)
Knuth, D.E.: The Art of Computer Programming. Fundamental Algorithms, vol. 1. Addison-Wesley, Reading (1998)
Knuth, D.E.: The Art of Computer Programming. Sorting and Searching, vol. 3. Addison-Wesley, Reading (1998)
Lent, J., Mahmoud, H.M.: Average-case analysis of multiple Quickselect: An algorithm for finding order statistics. Stat. Probab. Lett. 28, 299–310 (1996)
Mahmoud, H.M., Modarres, R., Smythe, R.T.: Analysis of Quickselect: An algorithm for order statistics. RAIRO Inform. Théor. Appl. 29, 255–276 (1995)
Mahmoud, H.M., Smythe, R.T.: Probabilistic analysis of multiple Quickselect. Algorithmica 22, 569–584 (1998)
Neininger, R., Rüschendorf, L.: Rates of convergence for Quickselect. J. Algorithms 44, 51–62 (2002)
Prodinger, H.: Multiple Quickselect—Hoare’s Find algorithm for several elements. Inf. Process. Lett. 56, 123–129 (1995)
Régnier, M.: A limiting distribution of Quicksort. RAIRO Inform. Théor. Appl. 23, 335–343 (1989)
Rösler, U.: A limit theorem for Quicksort. RAIRO Inform. Théor. Appl. 25, 85–100 (1991)
Vallée, B., Clément, J., Fill, J.A., Flajolet, P.: The number of symbol comparisons in Quicksort and Quickselect. Preprint (2009)
Author information
Authors and Affiliations
Corresponding author
Additional information
Research for both authors supported by NSF grant DMS–0406104, and by The Johns Hopkins University’s Acheson J. Duncan Fund for the Advancement of Research in Statistics.
Rights and permissions
About this article
Cite this article
Fill, J.A., Nakama, T. Analysis of the Expected Number of Bit Comparisons Required by Quickselect. Algorithmica 58, 730–769 (2010). https://doi.org/10.1007/s00453-009-9294-3
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-009-9294-3