Faster, Space-Efficient Selection Algorithms in Read-Only Memory for Integers

  • Timothy M. Chan
  • J. Ian Munro
  • Venkatesh Raman
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8283)


Starting with Munro and Paterson (1980), the selection or median-finding problem has been extensively studied in the read-only memory model and in streaming models. Munro and Paterson’s deterministic algorithm and its subsequent refinements require at least polylogarithmic or logarithmic space, whereas the algorithms by Munro and Raman (1996) and Raman and Ramnath (1999) can be made to use just O(1) storage cells but take O(n 1 + ε ) time for an arbitrarily small constant ε > 0.

In this paper, we show that faster selection algorithms in read-only memory are possible if the input is a sequence of integers. For example, one algorithm uses O(1) storage cells and takes \(O(n\lg U)\) time where U is the universe size. Another algorithm uses O(1) storage cells and takes \(O(n\lg n\lg\lg U)\) time. We also describe an O(n)-time algorithm for finding an approximate median using \(O(\lg^\epsilon U)\) storage cells.

All our algorithms are simple and deterministic. Interestingly, one of our algorithms is inspired by ‘centroids’ of binary trees and finds an approximate median by repeatedly invoking a textbook algorithm for the ‘majority’ problem. This technique could be of independent interest.


Selection Algorithm Storage Cell Logarithmic Space Stream Algorithm Streaming Algorithm 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Beame, P.: A general sequential time-space tradeoff for finding unique elements. SIAM Journal on Computing 20(2), 270–277 (1991)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Blum, M., Floyd, R.W., Pratt, V., Rivest, R.L., Tarjan, R.E.: Time bounds for selection. Journal of Computer and System Sciences 7, 448–461 (1973)MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Borodin, A., Cook, S.A.: A time-space tradeoff for sorting on a general sequential model of computation. SIAM Journal on Computing 11, 287–297 (1982)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Boyer, R.S., Moore, J.S.: MJRTY - A fast majority vote algorithm. In: Boyer, R.S. (ed.) Automated Reasoning: Essays in Honor of Woody Bledsoe. Automated Reasoning Series, pp. 105–117. Kluwer (1991)Google Scholar
  5. 5.
    Chakrabarti, A., Jayram, T.S., Pǎtraşcu, M.: Tight lower bound for selection in randomly ordered streams. In: Proceedings of the 19th ACM-SIAM Symposium on Discrete Algorithms (SODA), pp. 720–729 (2008)Google Scholar
  6. 6.
    Chan, T.M.: Comparison-based time-space lower bounds for selection. ACM Transactions on Algorithms 6(2), 26 (2010)MathSciNetCrossRefGoogle Scholar
  7. 7.
    Dietz, P.F.: Optimal algorithms for list indexing and subset rank. In: Dehne, F., Santoro, N., Sack, J.-R. (eds.) WADS 1989. LNCS, vol. 382, pp. 39–46. Springer, Heidelberg (1989)CrossRefGoogle Scholar
  8. 8.
    Elmasry, A., Juhl, D.D., Katajainen, J., Satti, S.R.: Selection from read-only memory with limited work space. In: Du, D.-Z., Zhang, G. (eds.) COCOON 2013. LNCS, vol. 7936, pp. 147–157. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  9. 9.
    Frederickson, G.: Upper bounds for time-space trade-offs in sorting and selection. Journal of Computer and System Sciences 34(1), 19–26 (1987)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Fredman, M.L., Willard, D.E.: Surpassing the information theoretic bound with fusion trees. Journal of Computer and System Sciences 47, 424–436 (1993)MathSciNetCrossRefzbMATHGoogle Scholar
  11. 11.
    Greenwald, M., Khanna, S.: Space-efficient online computation of quantile summaries. In: Proceedings of ACM SIGMOD, pp. 58–66 (2001)Google Scholar
  12. 12.
    Manku, G.S., Rajagopalan, S., Lindsay, B.G.: Approximate medians and other quantiles in one pass with limited memory. Proceedings of ACM SIGMOD 27(2), 426–435 (1998)CrossRefGoogle Scholar
  13. 13.
    Munro, J.I., Paterson, M.: Selection and sorting with limited storage. Theoretical Computer Science 12, 315–323 (1980)MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Munro, J.I., Raman, V.: Selection from read-only memory and sorting with optimum data movement. Theoretical Computer Science 165(2), 311–323 (1996)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Raman, V., Ramnath, S.: Improved upper bounds for time-space tradeoffs for selection. Nordic Journal of Computing 6(2), 162–180 (1999)MathSciNetzbMATHGoogle Scholar
  16. 16.
    Shrivastava, N., Buragohain, C., Agrawal, D., Suri, S.: Medians and beyond: new aggregation techniques for sensor networks. In: Proceedings of the 2nd International Conference on Embedded Networked Sensor Systems, pp. 239–249 (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Timothy M. Chan
    • 1
  • J. Ian Munro
    • 1
  • Venkatesh Raman
    • 2
  1. 1.Cheriton School of Computer ScienceUniversity of WaterlooWaterlooCanada
  2. 2.The Institute of Mathematical sciencesChennaiIndia

Personalised recommendations