左平衡二叉树 [英] Left balanced binary trees

查看:92
本文介绍了左平衡二叉树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在读一本关于数据结构的书,它说左平衡的二叉树是一棵树,其中的叶子仅占据最后一层中的最左边的位置.

I am reading a book on data structures and it says that a left balanced binary tree is a tree in which the leaves only occupy the leftmost positions in the last level.

对我来说这似乎有点模糊.这是否意味着叶子仅在根的左侧并且分布在整个级别上,或者叶子仅在整个树的左侧存在.究竟什么构成左平衡?

This seemed a little vague to me. Does this mean that leaves are only on the left side of a root and are distributed throughout the whole level, or leave exists only on the left side of the entire tree. Exactly what constitute left balanced?

我不确定我的猜测是否涵盖了任何答案,因此,如果有人可以提供帮助,将不胜感激:-).

I am not sure if my guess even covers any of the answer, so if anyone could help, it would be greatly appreciated :-).

推荐答案

您可以将左平衡的二叉树视为平衡的二叉树,其中每个节点的左子树在右子树之前被填充.用更非正式的术语来说,这是一棵树,其中最底层的节点都在整个树的左侧.

You can think of a left-balanced binary tree as a balanced binary tree where the left sub-tree of each node is filled before the right sub-tree. In more informal terms, this is a tree wherein the nodes at the bottom-most level are all on the left side of the entire tree.

以这棵树为例:

这棵树是平衡的,但不是左平衡的.但是,如果删除节点67,则树将保持左平衡.

This tree is balanced, but not left-balanced. If node 67 were removed, however, the tree would be left-balanced.

这篇关于左平衡二叉树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆