MCPcopy Create free account
hub / github.com/Flamewaker/JavaPersonalSummary / shellSort

Method shellSort

Code/leetcode/Sort/Sort.java:104–120  ·  view source on GitHub ↗

希尔排序 - 插入排序的改进版。为了减少数据的移动次数,在初始序列较大时取较大的步长,通常取序列长度的一半,此时只有两个元素比较,交换一次;之后步长依次减半直至步长为1,即为插入排序,由于此时序列已接近有序,故插入元素时数据移动的次数会相对较少,效率得到了提高。 时间复杂度:通常认为是O(N3/2) ,未验证 稳定性:不稳定 @param arr

(int arr[])

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected