12
$\begingroup$

Given a sequence of $n$ numbers, can it be sorted with $O(n \ln n)$ comparisons and $O(n)$ swaps/moves? Any pointer to publications on that matter or counterarguments showing a $\Omega(n \ln n)$ lower bound would help.

$\endgroup$
3
  • $\begingroup$ Any comparison based sorting algorithm will need to perform $\Omega(n \log n)$ comparisons and $\Omega(n)$ swaps in the worst case (cf. CLRS). $\endgroup$
    – Kaveh
    Jul 6, 2011 at 9:37
  • 4
    $\begingroup$ Trivially, you can achieve $O(n)$ moves if you first sort a table that contains the indexes of the elements, and only after that sort the table that contains the elements. $\endgroup$ Jul 6, 2011 at 10:01
  • $\begingroup$ @jukka well that's cheating coz you moved elements when you sorted the table ... $\endgroup$ Jul 9, 2011 at 12:58

1 Answer 1

15
$\begingroup$

There exists a stable in-place sorting algorithm with $O(n \log n)$ comparisons and $O(n)$ moves.

See: Gianni Franceschini: Sorting Stably, in Place, with $O(n \log n)$ Comparisons and $O(n)$ Moves. Theory Comput. Syst. 40(4): 327-353 (2007)
http://www.springerlink.com/content/d7348168624070v7/

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.