From 541f384e7c8bda2d5d695429a6e4b7d118db1417 Mon Sep 17 00:00:00 2001 From: liuyuxin Date: Sun, 14 May 2023 01:19:06 +0800 Subject: [PATCH] Fix function call error and null safety (#491) --- codes/dart/chapter_tree/avl_tree.dart | 2 +- codes/dart/chapter_tree/binary_search_tree.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/codes/dart/chapter_tree/avl_tree.dart b/codes/dart/chapter_tree/avl_tree.dart index 379f6868..67fa1cd5 100644 --- a/codes/dart/chapter_tree/avl_tree.dart +++ b/codes/dart/chapter_tree/avl_tree.dart @@ -143,7 +143,7 @@ class AVLTree { while (temp!.left != null) { temp = temp.left; } - node.right = removeHelper(node.right, temp!.val); + node.right = removeHelper(node.right, temp.val); node.val = temp.val; } } diff --git a/codes/dart/chapter_tree/binary_search_tree.dart b/codes/dart/chapter_tree/binary_search_tree.dart index 5c172e54..8ba6c230 100644 --- a/codes/dart/chapter_tree/binary_search_tree.dart +++ b/codes/dart/chapter_tree/binary_search_tree.dart @@ -135,7 +135,7 @@ void main() { print("\n查找到的节点对象为 $node,节点值 = ${node?.val}"); /* 插入节点 */ - node = insert(16); + insert(16); print("\n插入节点 16 后,二叉树为\n"); printTree(getRoot());