How to sort nearly sorted array in the fastest time possible? (Java)

前端 未结 10 2176
没有蜡笔的小新
没有蜡笔的小新 2020-12-30 06:14

I have an array of values which is almost, but not quite sorted, with a few values displaced (say, 50 in 100000). How to sort it most efficiently? (performance is absolutely

10条回答
  •  长情又很酷
    2020-12-30 06:39

    Actually, the Wikipedia contains a Java implementation of smoothsort. You can find it here:

    http://en.wikipedia.org/wiki/Smoothsort.

提交回复
热议问题