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

@ -11,7 +11,7 @@ import (
. "github.com/krahets/hello-algo/pkg"
)
func TestLevelOrder(t *testing.T) {
func TestHierOrder(t *testing.T) {
/* 初始化二叉树 */
// 这里借助了一个从数组直接生成二叉树的函数
root := ArrToTree([]any{1, 2, 3, 4, 5, 6, 7})
@ -19,6 +19,6 @@ func TestLevelOrder(t *testing.T) {
PrintTree(root)
// 层序遍历
nums := levelOrder(root)
nums := hierOrder(root)
fmt.Println("\n层序遍历的结点打印序列 =", nums)
}