summaryrefslogtreecommitdiff
path: root/sort/quick3way.go
diff options
context:
space:
mode:
Diffstat (limited to 'sort/quick3way.go')
-rw-r--r--sort/quick3way.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/sort/quick3way.go b/sort/quick3way.go
index 5263432..8434111 100644
--- a/sort/quick3way.go
+++ b/sort/quick3way.go
@@ -18,13 +18,12 @@ func quick3Way(a ds.ArrayList) {
return
}
- lt := 0 // Lower than
- i := 1 // lt..i contain duplicates
+ lt := 0 // Lower than
+ i := 1 // lt..i contain duplicates
gt := l - 1 // Greater than
- Insertion(a[0:3])
- a.Swap(0, 1)
- v := a[0] // Partitioning item
+ a.Swap(0, median(a, l))
+ v := a[0]
for i <= gt {
switch {