Finding median in read-only memory on integer input

Starting with Munro and Paterson (1980) 13], 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) 14] and Raman and Ramnath (1999) 15] can be made to use just O ( 1 ) storage cells but take O ( n 1 + e ) time for an arbitrarily small constant e 0 .In this paper, we initiate the first study on this problem when the input is a sequence of integers. We show that faster selection algorithms in read-only memory are possible if the input is a sequence of integers. For example, one of our algorithms uses O ( 1 ) storage cells and takes O ( n lg ? U ) 1 time where U is the universe size. Another algorithm uses O ( 1 ) storage cells and takes O ( n lg ? n lg ? lg ? U ) time. A combination of the two yields an algorithm that uses O ( 1 ) words of space and takes O ( n lg 1 + ? ? n ) time, a bound independent of U. We also describe an O ( n ) -time algorithm for finding an approximate median using O ( lg e ? 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.

[1]  Paul Beame A General Sequential Time-Space Tradeoff for Finding Unique Elements , 1991, SIAM J. Comput..

[2]  Greg N. Frederickson,et al.  Upper Bounds for Time-Space Trade-Offs in Sorting and Selection , 1987, J. Comput. Syst. Sci..

[3]  Manuel Blum,et al.  Time Bounds for Selection , 1973, J. Comput. Syst. Sci..

[4]  Venkatesh Raman,et al.  Improved Upper Bounds for Time-Space Trade-offs for Selection , 1999, Nord. J. Comput..

[5]  T. S. Jayram,et al.  Tight lower bounds for selection in randomly ordered streams , 2008, SODA '08.

[6]  Venkatesh Raman,et al.  Selection from Read-Only Memory and Sorting with Optimum Data Movement , 1992, FSTTCS.

[7]  Venkatesh Raman,et al.  Selection from Read-Only Memory and Sorting with Minimum Data Movement , 1996, Theor. Comput. Sci..

[8]  J. Ian Munro,et al.  Selection and sorting with limited storage , 1978, 19th Annual Symposium on Foundations of Computer Science (sfcs 1978).

[9]  Michael L. Fredman,et al.  Surpassing the Information Theoretic Bound with Fusion Trees , 1993, J. Comput. Syst. Sci..

[10]  Peter Bro Miltersen,et al.  Fusion Trees can be Implemented with AC0 Instructions Only , 1999, Theor. Comput. Sci..

[11]  Divyakant Agrawal,et al.  Medians and beyond: new aggregation techniques for sensor networks , 2004, SenSys '04.

[12]  Timothy M. Chan Comparison-based time-space lower bounds for selection , 2009, TALG.

[13]  Paul F. Dietz Optimal Algorithms for List Indexing and Subset Rank , 1989, WADS.

[14]  Venkatesh Raman,et al.  Improved Upper Bounds for Time-Space Tradeoffs for Selection with Limited Storage , 1998, SWAT.

[15]  Sanjeev Khanna,et al.  Space-efficient online computation of quantile summaries , 2001, SIGMOD '01.

[16]  Allan Borodin,et al.  A time-space tradeoff for sorting on a general sequential model of computation , 1980, STOC '80.

[17]  Robert S. Boyer,et al.  MJRTY: A Fast Majority Vote Algorithm , 1991, Automated Reasoning: Essays in Honor of Woody Bledsoe.

[18]  Amr Elmasry,et al.  Selection from read-only memory with limited workspace , 2013, Theor. Comput. Sci..