Generic and practical sorting algorithm faster than O(n log n)?

前端 未结 4 1079
情深已故
情深已故 2021-02-13 11:21

Is there any practical algorithm for generic elements (unlike counting sort or bucket sort) that runs faster than O(n log n)?

4条回答
  •  误落风尘
    2021-02-13 12:06

    No. This is one of the few rigorous minimum bounds for algorithms we have. For a collection of n elements, there are n! different orders, so to specify a given order we need log(n!) bits. By Stirling's approximation this is approximately n log n. For each comparison we do between elements, we get essentially one bit of information (ignoring the possibility of equal elements).

提交回复
热议问题