hello-algo/codes/go/pkg/tree_node_test.go

22 lines
319 B
Go
Raw Normal View History

2022-11-25 20:24:51 +08:00
// File: tree_node_test.go
// Created Time: 2022-11-25
// Author: Reanon (793584285@qq.com)
package pkg
import (
"fmt"
"testing"
)
2022-11-25 20:24:51 +08:00
func TestTreeNode(t *testing.T) {
2023-01-08 20:00:36 +08:00
arr := []any{1, 2, 3, nil, 5, 6, nil}
node := SliceToTree(arr)
2022-11-25 20:24:51 +08:00
// print tree
PrintTree(node)
2022-11-26 11:11:40 +08:00
// tree to arr
fmt.Println(TreeToSlice(node))
2022-11-25 20:24:51 +08:00
}