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
@@ -13,7 +13,7 @@ import (
func TestPreorderTraversalICompact(t *testing.T) {
/* 初始化二叉树 */
root := ArrToTree([]any{1, 7, 3, 4, 5, 6, 7})
root := SliceToTree([]any{1, 7, 3, 4, 5, 6, 7})
fmt.Println("\n初始化二叉树")
PrintTree(root)
@@ -30,7 +30,7 @@ func TestPreorderTraversalICompact(t *testing.T) {
func TestPreorderTraversalIICompact(t *testing.T) {
/* 初始化二叉树 */
root := ArrToTree([]any{1, 7, 3, 4, 5, 6, 7})
root := SliceToTree([]any{1, 7, 3, 4, 5, 6, 7})
fmt.Println("\n初始化二叉树")
PrintTree(root)
@@ -50,7 +50,7 @@ func TestPreorderTraversalIICompact(t *testing.T) {
func TestPreorderTraversalIIICompact(t *testing.T) {
/* 初始化二叉树 */
root := ArrToTree([]any{1, 7, 3, 4, 5, 6, 7})
root := SliceToTree([]any{1, 7, 3, 4, 5, 6, 7})
fmt.Println("\n初始化二叉树")
PrintTree(root)
@@ -70,7 +70,7 @@ func TestPreorderTraversalIIICompact(t *testing.T) {
func TestPreorderTraversalIIITemplate(t *testing.T) {
/* 初始化二叉树 */
root := ArrToTree([]any{1, 7, 3, 4, 5, 6, 7})
root := SliceToTree([]any{1, 7, 3, 4, 5, 6, 7})
fmt.Println("\n初始化二叉树")
PrintTree(root)