Local insertion sort revisited

  • Jyrki Katajainen
  • Christos Levcopoulos
  • Ola Petersson
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 401)


Two measures of presortedness, Dist(X) and logDist(X), are presented. The measures are motivated by a geometric interpretation of the input sequence X. Using these measures, an exact characterization of the local insertion sort algorithm of Mannila is achieved. Variants of local insertion sort, using many fingers (i.e., pointers into a finger search tree) instead of only one, are suggested. The number can either be fixed beforehand or dynamic, i.e., vary during the sorting process. Different strategies for moving the fingers yield different algorithms. Some general conditions which all strategies should satisfy are stated, and two such strategies are given. Furthermore, a method for designing dynamic algorithms that allocate an optimal number of fingers is provided. For any specific strategy satisfying our conditions, this method yields an optimal algorithm.

Key words

sorting algorithm measures presortedness local insertion sort finger search trees geometric interpretation 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [AI88]
    T. Altman and Y. Igarashi. Roughly sorting, sequential and parallel approach. Technical Report CS-88-7, Gunma University, Department of Computer Science, Kiryu, Japan, 1988.Google Scholar
  2. [CK80]
    C.R Cook and D.J. Kim. Best sorting algorithms for nearly sorted lists. Communications of the ACM, 23(11):620–624, 1980.CrossRefGoogle Scholar
  3. [Ede87]
    H. Edelsbrunner. Algorithms in Combinatorial Geometry. Springer-Verlag, Berlin/Heidelberg, F.R.Germany, 1987.Google Scholar
  4. [EW87]
    V. Estivill-Castro and D. Wood. A new measure of presortedness. Research Report CS-87-58, University of Waterloo, Department of Computer Science, Waterloo, Canada, 1987.Google Scholar
  5. [GMPR77]
    L.J. Guibas, E.M. McCreight, M.F. Plass, and J.R. Roberts. A new representation of linear lists. In Proc. 9th Annual ACM Symposium on Theory of Computing, pages 49–60, 1977.Google Scholar
  6. [Knu73]
    D.E. Knuth. The Art of Computer Programming, Vol. 3: Sorting and Searching. Addison-Wesley, Reading, Mass., 1973.Google Scholar
  7. [LP88]
    C. Levcopoulos and O. Petersson. An optimal parallel algorithm for sorting presorted files. In Proc. 8th Conference on Foundations of Software Technology and Theoretical Computer Science, pages 154–160, Springer-Verlag, 1988.Google Scholar
  8. [LP89]
    C. Levcopoulos and O. Petersson. Heapsort—adapted for presorted files. In Proc. 1989 Workshop on Algorithms and Data Structures, Springer-Verlag, 1989. To appear.Google Scholar
  9. [Man84]
    H Mannila. Implementation of a sorting algorithm suitable for presorted files. Technical Report, Department of Computer Science, University of Helsinki, Finland, 1984.Google Scholar
  10. [Man85]
    H. Mannila. Measures of presortedness and optimal sorting algorithms. IEEE Transactions on Computers, C-34(4):318–325, 1985.Google Scholar
  11. [Meh79]
    K. Mehlhorn. Sorting presorted files. In Proc. 4th GI Conference on Theoretical Computer Science, pages 199–212, Springer-Verlag, 1979.Google Scholar
  12. [Meh84a]
    K. Mehlhorn. Data Structures and Algorithms, Vol 1: Sorting and Searching. Springer-Verlag, Berlin/Heidelberg, F.R.Germany, 1984.Google Scholar
  13. [Meh84b]
    K. Mehlhorn. Data Structures and Algorithms, Vol. 3: Multidimensional Searching and Computational Geometry. Springer-Verlag, Berlin/Heidelberg, F.R.Germany, 1984.Google Scholar
  14. [Ove83]
    M.H. Overmars. The Design of Dynamic Data Structures. Lecture Notes in Computer Science 156, Springer-Verlag, Berlin/Heidelberg, F.R.Germany, 1983.Google Scholar
  15. [PS85]
    F.P. Preparata and M.I. Shamos. Computational Geometry: An Introduction. Springer-Verlag, New York, N.Y., 1985.Google Scholar
  16. [PS86]
    J.L. Peterson and A. Silberschatz. Operating System Concepts. Addison Wesley, Reading, Mass., second edition, 1986.Google Scholar
  17. [Ski88]
    S.S. Skiena. Encroaching lists as a measure of presortedness. BIT, 28:775–784, 1988.MathSciNetGoogle Scholar
  18. [TVW88]
    R.E. Tarjan and C.J. Van Wyk. An O(n log log n)-time algorithm for triangulating a simple polygon. SIAM Journal on Computing, 17(1):143–178, 1988.CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1989

Authors and Affiliations

  • Jyrki Katajainen
    • 1
  • Christos Levcopoulos
    • 1
  • Ola Petersson
    • 1
  1. 1.Department of Computer and Information ScienceLinköping UniversityLinköpingSweden

Personalised recommendations