Add Go codes to docs, including

the chapter of stack and queue, the chapter of tree.
This commit is contained in:
Yudong Jin
2022-12-03 20:25:24 +08:00
parent 1d9a076cdd
commit ebf9024136
41 changed files with 898 additions and 486 deletions

View File

@@ -5,6 +5,7 @@
package chapter_searching
import (
"fmt"
"testing"
. "github.com/krahets/hello-algo/pkg"
@@ -16,10 +17,10 @@ func TestLinearSearch(t *testing.T) {
// 在数组中执行线性查找
index := linerSearchArray(nums, target)
t.Log("目标元素 3 的索引 =", index)
fmt.Println("目标元素 3 的索引 =", index)
// 在链表中执行线性查找
head := ArrayToLinkedList(nums)
node := linerSearchLinkedList(head, target)
t.Log("目标结点值 3 的对应结点对象为", node)
fmt.Println("目标结点值 3 的对应结点对象为", node)
}