In the comparison model the only operations allowed on input elements are comparisons and moves to empty cells of memory. We prove the existence of an algorithm that, for any set of s ≤ n sorted sequences containing a total of n elements, computes the whole sorted sequence using O(n log s) comparisons, O(n) data moves and O(1) auxiliary cells of memory besides the ones necessary for the n input elements. The best known algorithms with these same bounds are limited to the particular case s -O(1). From a more intuitive point of view, our result shows that it is possible to pass from merging to sorting in a seamless fashion, without losing the optimality with respect to any of the three main complexity measures of the comparison model. Our main statement has an implication in the field of adaptive sorting algorithms and improves [Franceschini and Geffert, Journal of the ACM, 52], showing that it is possible to exploit some form of pre-sortedness to lower the number of comparisons while still maintaining the optimality for space and data moves. More precisely, let us denote with Opt<inf>M</inf>(X) the cost for sorting a sequence X with an algorithm that is optimal with respect to a pre-sortedness measure M. To the best of our knowledge, so far, for any pre-sortedness measure M, no full-optimal adaptive sorting algorithms were known (see [Estivill-Castro and Wood, ACM Comp. Surveys, 24], page 472). The best that could be obtained were algorithms sorting a sequence X using O(1) space, O(Opt<inf>M</inf>(X)) comparisons and O(Opt<inf>M</inf>(X)) moves. Hence, the move complexity seemed bound to be a function of M(X) (as for the comparison complexity). We prove that there exists a pre-sortedness measure for which that is false: the pre-sortedness measure Runs, defined as the number of ascending contiguous subsequences in a sequence. That follows directly from our main statement, since Opt<inf>M</inf>(X) = O(|X| log Runs(X)). © Springer-Verlag Berlin Heidelberg 2006.

Sorting by Merging or Merging by Sorting? / Franceschini, Gianni. - STAMPA. - 4059:(2006), pp. 77-89. (Intervento presentato al convegno 10th Scandinavian Workshop on Algorithm Theory, SWAT 2006 tenutosi a Riga; Latvia nel July 6-8) [10.1007/11785293_10].

Sorting by Merging or Merging by Sorting?

FRANCESCHINI, GIANNI
2006

Abstract

In the comparison model the only operations allowed on input elements are comparisons and moves to empty cells of memory. We prove the existence of an algorithm that, for any set of s ≤ n sorted sequences containing a total of n elements, computes the whole sorted sequence using O(n log s) comparisons, O(n) data moves and O(1) auxiliary cells of memory besides the ones necessary for the n input elements. The best known algorithms with these same bounds are limited to the particular case s -O(1). From a more intuitive point of view, our result shows that it is possible to pass from merging to sorting in a seamless fashion, without losing the optimality with respect to any of the three main complexity measures of the comparison model. Our main statement has an implication in the field of adaptive sorting algorithms and improves [Franceschini and Geffert, Journal of the ACM, 52], showing that it is possible to exploit some form of pre-sortedness to lower the number of comparisons while still maintaining the optimality for space and data moves. More precisely, let us denote with OptM(X) the cost for sorting a sequence X with an algorithm that is optimal with respect to a pre-sortedness measure M. To the best of our knowledge, so far, for any pre-sortedness measure M, no full-optimal adaptive sorting algorithms were known (see [Estivill-Castro and Wood, ACM Comp. Surveys, 24], page 472). The best that could be obtained were algorithms sorting a sequence X using O(1) space, O(OptM(X)) comparisons and O(OptM(X)) moves. Hence, the move complexity seemed bound to be a function of M(X) (as for the comparison complexity). We prove that there exists a pre-sortedness measure for which that is false: the pre-sortedness measure Runs, defined as the number of ascending contiguous subsequences in a sequence. That follows directly from our main statement, since OptM(X) = O(|X| log Runs(X)). © Springer-Verlag Berlin Heidelberg 2006.
2006
10th Scandinavian Workshop on Algorithm Theory, SWAT 2006
Auxiliary cells; Comparison model; Complexity measures
04 Pubblicazione in atti di convegno::04b Atto di convegno in volume
Sorting by Merging or Merging by Sorting? / Franceschini, Gianni. - STAMPA. - 4059:(2006), pp. 77-89. (Intervento presentato al convegno 10th Scandinavian Workshop on Algorithm Theory, SWAT 2006 tenutosi a Riga; Latvia nel July 6-8) [10.1007/11785293_10].
File allegati a questo prodotto
Non ci sono file associati a questo prodotto.

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/11573/59182
 Attenzione

Attenzione! I dati visualizzati non sono stati sottoposti a validazione da parte dell'ateneo

Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 1
  • ???jsp.display-item.citation.isi??? ND
social impact