skip to main content
research-article

No sorting? better searching!

Published:28 March 2008Publication History
Skip Abstract Section

Abstract

Questions about order versus disorder in systems and models have been fascinating scientists over the years. In computer science, order is intimately related to sorting, commonly meant as the task of arranging keys in increasing or decreasing order with respect to an underlying total order relation. The sorted organization is amenable for searching a set of n keys, since each search requires Θ(log n) comparisons in the worst case, which is optimal if the cost of a single comparison can be considered a constant. Nevertheless, we prove that disorder implicitly provides more information than order does. For the general case of searching an array of multidimensional keys whose comparison cost is proportional to their length (and hence which cannot be considered a constant), we demonstrate that “suitable” disorder gives better bounds than those derivable by using the natural lexicographic order.

We start from previous work done by Andersson et al. [2001], who proved that Θ(k log log n/log log(4 + klog log n/log n) + k + log n) character comparisons (or probes) comprise the tight complexity for searching a plain sorted array of n keys, each of length k, arranged in lexicographic order. We describe a novel permutation of the n keys that is different from the sorted order. When keys are kept “unsorted” in the array according to this permutation, the complexity of searching drops to Θ(k + log n) character comparisons (or probes) in the worst case, which is optimal among all possible permutations, up to a constant factor. Consequently, disorder carries more information than does order; this fact was not observable before, since the latter two bounds are Θ(log n) when k = O(1). More implications are discussed in the article, including searching in the bit-probe model.

References

  1. Andersson, A., Hagerup, T., Håstad, J., and Petersson, O. 2001. Tight bounds for searching a sorted array of strings. SIAM J. Comput. 30, 5 (Oct.), 1552--1578. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Andersson, A., Håstad, J., and Petersson, O. 1995. A tight lower bound for searching a sorted array. In Proceedings of the 27th Annual ACM Symposium on the Theory of Computing (STOC). ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Andersson, A., Hagerup, T., Håstad, J., and Petersson, O. 1994. The complexity of searching a sorted array of strings. In Proceedings of the 26th Annual ACM Symposium on the Theory of Computing (STOC), Montreal, Quebec, Canada. ACM Press, 317--325. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Bentley, J. L., and Sedgewick, R. 1997. Fast algorithms for sorting and searching strings. In Proceedings of the 8th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), New Orleans, LA. ACM Press, 360--369. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Elias, P., and Flower, R. A. 1975. The complexity of some simple retrieval problems. J. ACM 22, 3, 367--379. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Fiat, A., and Naor, M. 1993. Implicit O(1) probe search. SIAM J. Comput. 22, 1, 1--10. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Fiat, A., and Naor, M. 1989. Implicit O(1) probe search. In Proceedings of the 21st Annual ACM Symposium on Theory of Computing (STOC), Seattle, WA. ACM Press, 336--344. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Fiat, A., Naor, M., Schmidt, J. P., and Siegel, A. 1992. Nonoblivious hashing. J. ACM 39, 4 (Oct.), 764--782. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Fiat, A., Munro, J. I., Naor, M., Schäffer, A. A., Schmidt, J. P., and Siegel, A. 1991. An implicit data structure for searching a multikey table in logarithmic time. J. Comput. Syst. Sci. 43, 3 (Dec.), 406--424.Google ScholarGoogle ScholarCross RefCross Ref
  10. Fiat, A., Naor, M., Schmidt, J., and Siegel, A. 1988. Non-Oblivious hashing. In Proceedings of the 20th Annual ACM Symposium on Theory of Computing (STOC), Chicago. IL. ACM Press, 367--376. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Fredman, M. L., Komlós, J., and Szemerédi, E. 1984. Storing a sparse table with O(1) worst case access time. J. ACM 31, 3, 538--544. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Hirschberg, D. S. 1980. On the complexity of searching a set of vectors. SIAM J. Comput. 9, 1, 126--129.Google ScholarGoogle ScholarCross RefCross Ref
  13. Hirschberg, D. S. 1978. A lower worst-case complexity for searching a dictionary. In Proceedings of the 16th Annual Allerton Conference on Communication, Control, and Computing, 50--53.Google ScholarGoogle Scholar
  14. Knuth, D. E. 1998. The Art of Computer Programming III: Sorting and Searching (2nd ed.). Addison-Wesley, Reading, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Kosaraju, S. R. 1979. On a multidimensional search problem. In Proceedings of the 11th Annual ACM Symposium on Theory of Computing (STOC), 67--73. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Manber, U., and Myers, G. 1993. Suffix arrays: A new method for on-line string searches. SIAM J. Comput. 22, 5 (Oct.), 935--948. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Munro, J. I. 1986. An implicit data structure supporting insertion, deletion, and search in O(log2 n) time. J. Comput. Syst. Sci. 33, 1, 66--74. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Munro, J. I., and Suwanda, H. 1980. Implicit data structures for fast search and update. J. Comput. Syst. Sci. 21, 2, 236--250.Google ScholarGoogle ScholarCross RefCross Ref
  19. Yao, A. C. 1984. Should tables be sorted? J. ACM 31, 245--281.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. No sorting? better searching!

              Recommendations

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in

              Full Access

              • Published in

                cover image ACM Transactions on Algorithms
                ACM Transactions on Algorithms  Volume 4, Issue 1
                March 2008
                343 pages
                ISSN:1549-6325
                EISSN:1549-6333
                DOI:10.1145/1328911
                Issue’s Table of Contents

                Copyright © 2008 ACM

                Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 28 March 2008
                • Accepted: 1 January 2007
                • Received: 1 March 2005
                Published in talg Volume 4, Issue 1

                Permissions

                Request permissions about this article.

                Request Permissions

                Check for updates

                Qualifiers

                • research-article
                • Research
                • Refereed

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader