summaryrefslogtreecommitdiff
path: root/ds/arraylist.go
diff options
context:
space:
mode:
authorPaul Buetow <git@mx.buetow.org>2020-08-06 11:06:05 +0100
committerPaul Buetow <git@mx.buetow.org>2020-08-06 11:06:05 +0100
commitddee1778446fbdf17587fed5ba2b6edc76c05b69 (patch)
tree6529df91a69b1273fced8fc0ebbeb023cf599153 /ds/arraylist.go
parente858efc16960b86175d655add938acd3f1edd13e (diff)
initial quick sort but have to figure out why it is so slow
Diffstat (limited to 'ds/arraylist.go')
-rw-r--r--ds/arraylist.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/ds/arraylist.go b/ds/arraylist.go
index 65c42ef..243efe1 100644
--- a/ds/arraylist.go
+++ b/ds/arraylist.go
@@ -35,3 +35,9 @@ func (a ArrayList) Sorted() bool {
}
return true
}
+
+func (a ArrayList) Swap(i, j int) {
+ tmp := a[i]
+ a[i] = a[j]
+ a[j] = tmp
+}