摘要: 10,11,7,6,8,9 package tree.bst.avl; public class AVLTreeDemo { public static void main(String[] args) { //int[] arr = {4,3,6,5,7,8}; //int[] arr = {10 阅读全文
posted @ 2021-08-16 16:29 brady-wang 阅读(62) 评论(0) 推荐(0) 编辑
摘要: 左旋——自己变为右孩子的左孩子;右旋——自己变为左孩子的右孩子; 以上口诀+动图=完美 高度平衡的搜索二叉树 一棵平衡树,或是空树,或是具有以下性质的二叉搜索树:左子树和右子树都是AVL树,且左右子树的高度之差的绝对值不超过1。 平衡化旋转 AVL树相较于普通的二叉搜索树,自主要的就是做了平衡化处理 阅读全文
posted @ 2021-08-16 15:28 brady-wang 阅读(609) 评论(0) 推荐(0) 编辑
摘要: package tree.bst.avl; public class AVLTreeDemo { public static void main(String[] args) { int[] arr = {4,3,6,5,7,8}; AvlTree avlTree = new AvlTree(); 阅读全文
posted @ 2021-08-16 13:52 brady-wang 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 删除叶子节点 删除只有一个的子节点的 删除有两个子节点的 package tree.bst; public class bstDemo { public static void main(String[] args) { System.out.println("二叉排序树"); BstTree bs 阅读全文
posted @ 2021-08-16 11:39 brady-wang 阅读(84) 评论(0) 推荐(0) 编辑
摘要: package tree.bst; public class bstDemo { public static void main(String[] args) { System.out.println("二叉排序树"); BstTree bstTree = new BstTree(); int[] 阅读全文
posted @ 2021-08-16 10:54 brady-wang 阅读(108) 评论(0) 推荐(0) 编辑