Update the array and linked list (Go code).

This commit is contained in:
Yudong Jin
2023-01-02 18:59:35 +08:00
parent fd4737ef45
commit 1f1c58519d
3 changed files with 18 additions and 17 deletions
@@ -5,7 +5,6 @@
package chapter_array_and_linkedlist
import (
"fmt"
"math/rand"
)
@@ -60,9 +59,10 @@ func traverse(nums []int) {
for i := 0; i < len(nums); i++ {
count++
}
count = 0
// 直接遍历数组
for index, val := range nums {
fmt.Printf("index:%v value:%v\n", index, val)
for range nums {
count++
}
}