题目

LeetCode将有序数组转换为二叉搜索树(Python)
要看懂这道题想让你干什么,首先得知道什么是一棵高度平衡二叉搜索树。根据维基百科
LeetCode将有序数组转换为二叉搜索树(Python)
根据百度百科
LeetCode将有序数组转换为二叉搜索树(Python)
因此,一棵高度平衡二叉搜索树(AVL树)就是满足了以上两个条件的二叉树:
LeetCode将有序数组转换为二叉搜索树(Python)

解题思路

读懂了题目之后,会发现并不难:
LeetCode将有序数组转换为二叉搜索树(Python)
执行结果为:

LeetCode将有序数组转换为二叉搜索树(Python)

相关文章: