2022-11-25 12:24:51 +00:00
|
|
|
// File: tree_node_test.go
|
|
|
|
// Created Time: 2022-11-25
|
|
|
|
// Author: Reanon (793584285@qq.com)
|
|
|
|
|
|
|
|
package pkg
|
|
|
|
|
2022-12-03 12:25:24 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
)
|
2022-11-25 12:24:51 +00:00
|
|
|
|
|
|
|
func TestTreeNode(t *testing.T) {
|
|
|
|
arr := []int{2, 3, 5, 6, 7}
|
|
|
|
node := ArrayToTree(arr)
|
|
|
|
|
|
|
|
// print tree
|
|
|
|
PrintTree(node)
|
2022-11-26 03:11:40 +00:00
|
|
|
|
|
|
|
// tree to arr
|
2022-12-03 12:25:24 +00:00
|
|
|
fmt.Println(TreeToArray(node))
|
2022-11-25 12:24:51 +00:00
|
|
|
}
|