Update codes of heap.java and my_heap.java

This commit is contained in:
Yudong Jin
2023-01-08 22:18:23 +08:00
parent e8f7d8f8ba
commit ecabb4077b
7 changed files with 307 additions and 16 deletions

View File

@ -30,7 +30,7 @@ public class binary_tree_bfs {
public static void main(String[] args) {
/* 初始化二叉树 */
// 这里借助了一个从数组直接生成二叉树的函数
TreeNode root = TreeNode.arrToTree(new Integer[] { 1, 2, 3, 4, 5, 6, 7 });
TreeNode root = TreeNode.listToTree(Arrays.asList(1, 2, 3, 4, 5, 6, 7));
System.out.println("\n初始化二叉树\n");
PrintUtil.printTree(root);

View File

@ -43,7 +43,7 @@ public class binary_tree_dfs {
public static void main(String[] args) {
/* 初始化二叉树 */
// 这里借助了一个从数组直接生成二叉树的函数
TreeNode root = TreeNode.arrToTree(new Integer[] { 1, 2, 3, 4, 5, 6, 7 });
TreeNode root = TreeNode.listToTree(Arrays.asList(1, 2, 3, 4, 5, 6, 7));
System.out.println("\n初始化二叉树\n");
PrintUtil.printTree(root);