feat(go/tree): support array binary tree (#655)

This commit is contained in:
Reanon
2023-07-26 11:04:09 +08:00
committed by GitHub
parent 027bdd6510
commit 575bcf58ef
15 changed files with 226 additions and 81 deletions

View File

@@ -11,11 +11,11 @@ import (
func TestTreeNode(t *testing.T) {
arr := []any{1, 2, 3, nil, 5, 6, nil}
node := ArrToTree(arr)
node := SliceToTree(arr)
// print tree
PrintTree(node)
// tree to arr
fmt.Println(TreeToArray(node))
fmt.Println(TreeToSlice(node))
}