Is it possible to stably sort an array in O(n log n) with constant auxilliary space?

StackOverflow https://stackoverflow.com/questions/19275537

  •  30-06-2022
  •  | 
  •  

문제

Given an array of n elements, is there a sorting algorithm that

  1. sorts in at most O(n log n) time (and optionally, O(n) time in the best case)
  2. is stable
  3. takes O(1) auxilliary space

All sorting algorithms I found satisfy only two of these criteria:

  • bubble sort satisfies 2 and 3
  • merge sort satisfies 1 and 2
  • heap sort satisfies 1 and 3

Is there an algorithm that satisfies all three criteria?

도움이 되었습니까?

해결책

From: https://cstheory.stackexchange.com/

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) Link

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top