summaryrefslogtreecommitdiff
path: root/sort/shell.go
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2020-08-08 14:06:12 +0100
committerPaul Buetow <pbuetow@mimecast.com>2020-08-08 14:06:12 +0100
commit06c8d4c68650bbc1fc158d90a44c4c17644c7889 (patch)
tree3b2bd79680bc233dadd93e1a2be48e00ee60b66b /sort/shell.go
parent44e930b71107310eae55060cf0aa2cac7089d239 (diff)
wrapup
Diffstat (limited to 'sort/shell.go')
-rw-r--r--sort/shell.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/sort/shell.go b/sort/shell.go
index 4132ca6..4a8fded 100644
--- a/sort/shell.go
+++ b/sort/shell.go
@@ -17,12 +17,10 @@ func Shell(a ds.ArrayList) ds.ArrayList {
for h >= 1 {
for i := h; i < length; i++ {
for j := i; j >= h; j -= h {
- if a[j-h].Lower(a[j]) {
+ if a[j-h] < a[j] {
break
}
- tmp := a[j]
- a[j] = a[j-h]
- a[j-h] = tmp
+ a.Swap(j, j-h)
}
}