diff options
| author | Paul Buetow <paul@buetow.org> | 2020-07-21 20:41:37 +0100 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2020-07-21 20:41:37 +0100 |
| commit | de286db8594d547591ff765f4d5934d99248779b (patch) | |
| tree | d1c13a4a9ba1d60f60d9cda978b4a03f8ddd49ac /sort/insertion.go | |
| parent | dbd6388393282672859c789b0e1b58d4f8fd0d0b (diff) | |
merge sort works
Diffstat (limited to 'sort/insertion.go')
| -rw-r--r-- | sort/insertion.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sort/insertion.go b/sort/insertion.go index 465e8b4..9f7215b 100644 --- a/sort/insertion.go +++ b/sort/insertion.go @@ -12,9 +12,7 @@ func Insertion(a ds.ArrayList) ds.ArrayList { if a[j].Higher(a[j-1]) { break } - tmp := a[j] - a[j] = a[j-1] - a[j-1] = tmp + a.SwapPos(j, j-1) } } |
