Abstract
To take advantage of existing order in a sequence when sorting, we evaluate the quantity of this information by the minimal size of decomposition of the input sequence, particularly the minimal size of chain and of monotonic partitions. Some sorting strategies that are optimal with respect to these measures of presortedness are presented. The relationships between these new measures of presortedness and other known measures have also been explored. As an application, we carry out the optimality of an adaptive sorting algorithm Skiena'sMelsort. For some special partitioning strategies, we present two sorting algorithms based on Dijkstra'sSmoothsort. Moreover, the optimalities of these two algorithms are demonstrated. By examining the optimalities of sorting algorithms with respect to certain measures of presortedness, we also propose some optimal sorting strategies for one class of measures. Finally, we discuss other types of sorting problems, such as sorting multisets and topological sorting. In particular, we derive an optimal algorithm for sorting multisets and for finding the multiset sizes as well.
Similar content being viewed by others
References
Brandstädt, A., Kratsch, D.: On partitions of permutations into increasing and decreasing subsequences. J. Inf. Process. Cybern.22, 263–273 (1986)
Chen, J., Carlsson, S.: Measuring presortedness and evaluating disorder. In: Fifth SIAM Conference on Discrete Mathematics, Atlanta, GA, 1990
Cook, C.R., Kim, D.J.: Best sorting algorithm for nearly sorted lists. Commun. ACM23, 620–624 (1980)
Dijkstra, E.W.: Smoothsort, an alternative for sorting in situ. Sci. Comput. Program.1, 223–233 (1982)
Dilworth, R.P.: A decomposition theorem for partially ordered sets. Ann. Math.51, 161–166 (1950)
Dromey, R.G.: Exploiting partial order with quicksort. Software Pract. Exper.14, 509–518 (1984)
Estivill-Castro, V., Wood, D.: A new measure of presortedness. Inf. Comput.83, 111–119 (1989)
Hertel, S.: Smoothsort's behavior on presorted sequences. Inf. Process. Lett.16, 165–170 (1983)
Kirkpartrick, D.G., Seidel, R.: The ultimate planar convex hull algorithm? SIAM J. Comput.15, 287–299 (1986)
Knuth, D.E.: The Art of Computer Programming, Vol. 3: Sorting and Searching. Reading, M.A.: Addison-Wesley 1973
Mannila, H.: Measures of presortedness and optimal sorting algorithms. IEEE Trans. Comput.C-34, 318–325 (1985)
Mehlhorn, K.: Sorting presorted files. In: Weihrauch, K. (ed.) Theoretical Computer Science. Proceedings, Aachen 1979. (Lect. Notes Comput. Sci., Vol. 67, pp. 199–212) Berlin Heidelberg New York: Springer 1979
Petersson, O.: Adaptive sorting. PhD thesis, Lund University, December, 1990
Skiena, S.S.: Encroaching lists as a measure of presortedness. BIT28, 775–784 (1988)
Author information
Authors and Affiliations
Additional information
The main part of the work was conducted while the author was with Lund University.
Rights and permissions
About this article
Cite this article
Carlsson, S., Chen, J. On partitions and presortedness of sequences. Acta Informatica 29, 267–280 (1992). https://doi.org/10.1007/BF01185681
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF01185681