## ~telemachus/algorithms

c43967855e992983b2e500c69dff405396441c7e — Peter Aronoff 9 months ago
```Update for golangci-lint
```
```3 files changed, 16 insertions(+), 22 deletions(-)

M benchmark_binarysearchtree_traversal_test.go
M benchmark_quicksort_test.go
M binarysearchtree_example_test.go
```
`M benchmark_binarysearchtree_traversal_test.go => benchmark_binarysearchtree_traversal_test.go +0 -2`
```@@ 20,7 20,6 @@ func BenchmarkInOrderIterativeWalk(b *testing.B) {
t.Insert(17)
t.Insert(20)
show := func(i int) {
-		return
}
b.ResetTimer()
for i := 0; i < b.N; i++ {

@@ 42,7 41,6 @@ func BenchmarkInOrderRecursiveWalk(b *testing.B) {
t.Insert(17)
t.Insert(20)
show := func(i int) {
-		return
}
b.ResetTimer()
for i := 0; i < b.N; i++ {

```
`M benchmark_quicksort_test.go => benchmark_quicksort_test.go +4 -8`
```@@ 9,8 9,7 @@ import (
)

func shuffledSlice() sort.IntSlice {
-	var xs sort.IntSlice
-	xs = make([]int, 10000)
+	var xs sort.IntSlice = make([]int, 10000)
rand.Shuffle(len(xs), func(i, j int) {
xs[i], xs[j] = xs[j], xs[i]
})

@@ 19,8 18,7 @@ func shuffledSlice() sort.IntSlice {
}

func equalSlice() sort.IntSlice {
-	var xs sort.IntSlice
-	xs = make([]int, 10000)
+	var xs sort.IntSlice = make([]int, 10000)
for i := 0; i < 10000; i++ {
xs[i] = 1
}

@@ 29,8 27,7 @@ func equalSlice() sort.IntSlice {
}

func inOrderSlice() sort.IntSlice {
-	var xs sort.IntSlice
-	xs = make([]int, 10000)
+	var xs sort.IntSlice = make([]int, 10000)
for i := 0; i < 10000; i++ {
xs[i] = i
}

@@ 39,8 36,7 @@ func inOrderSlice() sort.IntSlice {
}

func reversedSlice() sort.IntSlice {
-	var xs sort.IntSlice
-	xs = make([]int, 10000)
+	var xs sort.IntSlice = make([]int, 10000)
for i, j := 0, 10000; i < 10000; i, j = i+1, j-1 {
xs[i] = j
}

```
`M binarysearchtree_example_test.go => binarysearchtree_example_test.go +12 -12`
```@@ 27,7 27,7 @@ func show(i int) {
fmt.Println(i)
}

-func ExampleInOrderWalk() {
+func ExampleTree_InOrderWalk() {
t := makeTree()
t.InOrderWalk(show)
// Output:

@@ 45,7 45,7 @@ func ExampleInOrderWalk() {
// 20
}

-func ExampleInOrderIterativeWalk() {
+func ExampleTree_InOrderIterativeWalk() {
t := makeTree()
t.InOrderIterativeWalk(show)
// Output:

@@ 63,7 63,7 @@ func ExampleInOrderIterativeWalk() {
// 20
}

-func ExamplePreOrderWalk() {
+func ExampleTree_PreOrderWalk() {
t := makeTree()
t.PreOrderWalk(show)
// Output:

@@ 81,7 81,7 @@ func ExamplePreOrderWalk() {
// 20
}

-func ExamplePreOrderIterativeWalk() {
+func ExampleTree_PreOrderIterativeWalk() {
t := makeTree()
t.PreOrderIterativeWalk(show)
// Output:

@@ 99,7 99,7 @@ func ExamplePreOrderIterativeWalk() {
// 20
}

-func ExamplePostOrderWalk() {
+func ExampleTree_PostOrderWalk() {
t := makeTree()
t.PostOrderWalk(show)
// Output:

@@ 117,7 117,7 @@ func ExamplePostOrderWalk() {
// 15
}

-func ExamplePostOrderIterativeWalk() {
+func ExampleTree_PostOrderIterativeWalk() {
t := makeTree()
t.PostOrderIterativeWalk(show)
// Output:

@@ 135,7 135,7 @@ func ExamplePostOrderIterativeWalk() {
// 15
}

-func ExampleDeleteNoChildren() {
+func ExampleTree_Delete_noChildren() {
t := makeTree()
t.Delete(2)
fmt.Println(t.Size())

@@ 155,7 155,7 @@ func ExampleDeleteNoChildren() {
// 20
}

-func ExampleDeleteRoot() {
+func ExampleTree_Delete_root() {
t := makeTree()
t.Delete(15)
fmt.Println(t.Size())

@@ 175,7 175,7 @@ func ExampleDeleteRoot() {
// 20
}

-func ExampleDeleteTwoChildren() {
+func ExampleTree_Delete_twoChildren() {
t := makeTree()
t.Delete(18)
fmt.Println(t.Size())

@@ 195,7 195,7 @@ func ExampleDeleteTwoChildren() {
// 20
}

-func ExampleDeleteLeftChildOnly() {
+func ExampleTree_Delete_leftChildOnly() {
t := makeTree()
t.Delete(13)
fmt.Println(t.Size())

@@ 215,7 215,7 @@ func ExampleDeleteLeftChildOnly() {
// 20
}

-func ExampleDeleteRightChildOnly() {
+func ExampleTree_Delete_rightChildOnly() {
t := makeTree()
t.Insert(5)
t.Delete(4)

@@ 237,7 237,7 @@ func ExampleDeleteRightChildOnly() {
// 20
}

-func ExampleDeleteMultipleItemsOfAllkinds() {
+func ExampleTree_Delete_multipleItemsOfAllkinds() {
t := makeTree()
t.Insert(5)
t.Delete(4)

```