Add build script for Go and update Go codes.

This commit is contained in:
krahets
2023-02-09 04:45:06 +08:00
parent 12c085a088
commit e8c78f89f0
39 changed files with 391 additions and 1468 deletions

View File

@ -5,7 +5,6 @@
package chapter_computational_complexity
import (
"fmt"
"math/rand"
)
@ -34,14 +33,3 @@ func findOne(nums []int) int {
}
return -1
}
/* Driver Code */
func main() {
for i := 0; i < 10; i++ {
n := 100
nums := randomNumbers(n)
index := findOne(nums)
fmt.Println("\n数组 [ 1, 2, ..., n ] 被打乱后 =", nums)
fmt.Println("数字 1 的索引为", index)
}
}

View File

@ -14,7 +14,7 @@ func TestWorstBestTimeComplexity(t *testing.T) {
n := 100
nums := randomNumbers(n)
index := findOne(nums)
fmt.Println("打乱后的数组为", nums)
fmt.Println("\n数组 [ 1, 2, ..., n ] 被打乱后 =", nums)
fmt.Println("数字 1 的索引为", index)
}
}