mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-24 10:33:34 +08:00
refactor: Replace 结点 with 节点 (#452)
* Replace 结点 with 节点 Update the footnotes in the figures * Update mindmap * Reduce the size of the mindmap.png
This commit is contained in:
@@ -15,27 +15,27 @@ func TestBinarySearchTree(t *testing.T) {
|
||||
fmt.Println("\n初始化的二叉树为:")
|
||||
bst.print()
|
||||
|
||||
// 获取根结点
|
||||
// 获取根节点
|
||||
node := bst.getRoot()
|
||||
fmt.Println("\n二叉树的根结点为:", node.Val)
|
||||
fmt.Println("\n二叉树的根节点为:", node.Val)
|
||||
|
||||
// 查找结点
|
||||
// 查找节点
|
||||
node = bst.search(7)
|
||||
fmt.Println("查找到的结点对象为", node, ",结点值 =", node.Val)
|
||||
fmt.Println("查找到的节点对象为", node, ",节点值 =", node.Val)
|
||||
|
||||
// 插入结点
|
||||
// 插入节点
|
||||
node = bst.insert(16)
|
||||
fmt.Println("\n插入结点后 16 的二叉树为:")
|
||||
fmt.Println("\n插入节点后 16 的二叉树为:")
|
||||
bst.print()
|
||||
|
||||
// 删除结点
|
||||
// 删除节点
|
||||
bst.remove(1)
|
||||
fmt.Println("\n删除结点 1 后的二叉树为:")
|
||||
fmt.Println("\n删除节点 1 后的二叉树为:")
|
||||
bst.print()
|
||||
bst.remove(2)
|
||||
fmt.Println("\n删除结点 2 后的二叉树为:")
|
||||
fmt.Println("\n删除节点 2 后的二叉树为:")
|
||||
bst.print()
|
||||
bst.remove(4)
|
||||
fmt.Println("\n删除结点 4 后的二叉树为:")
|
||||
fmt.Println("\n删除节点 4 后的二叉树为:")
|
||||
bst.print()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user