From ddee1778446fbdf17587fed5ba2b6edc76c05b69 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 6 Aug 2020 11:06:05 +0100 Subject: initial quick sort but have to figure out why it is so slow --- ds/arraylist.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ds/arraylist.go') 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 +} -- cgit v1.2.3