A balanced binary tree, also referred to as a height-balanced binary tree, is defined as a binary tree in which the height of the left and right subtree of any node differ by not more than 1.
Given a binary tree, determine if it is height-balanced.
Sample Input:
root = [ 1, 2, 3, 4, 5, 6, 7]
Sample Output:
True
数据结构和算法:初级练习题 #36 – 平衡二叉树
平衡二叉树又被称为AVL树。 它具有以下性质:它是一棵空树或它的左右两个子树的高度差的绝对值不超过1,并且左右两个子树都是一棵平衡二叉树。 平衡二叉树一般是一个有序树,它具有二叉树的所有性质,其遍历操作和二叉树的遍历操作相同。
给定一颗二叉树,检查它是否是平衡二叉树。
输入样例:
root = [ 1, 2, 3, 4, 5, 6, 7]
输出样例:
True