![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二叉查找树
zhangchengcheng1997
这个作者很懒,什么都没留下…
展开
-
Convert BST to Greater Tree
1、问题描述 Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key原创 2017-05-18 17:28:43 · 142 阅读 · 0 评论 -
在二叉查找树中插入节点
1、问题描述 给定一棵二叉查找树和一个新的树节点,将节点插入到树中。你需要保证该树仍然是一棵二叉查找树。样例给出如下一棵二叉查找树,在插入节点6之后这棵二叉查找树可以是这样的: 2 2 / \ / \1 4 --> 1 4 / / \ 3 3原创 2017-05-18 17:38:29 · 456 阅读 · 0 评论 -
二叉查找树总结
1、首先了解二叉排序树的性质:若它的左子树不空,左子树上所有节点的值均小于根节点的值;若它的右子树不空,右子树上所有节点的值均大于根节点的值;它的左右子树也都是二叉排序树。2、Convert BST to Greater Tree题进行反的中序遍历,结点的值 = 该结点的值 + 所有比它大的结点的值的和,最后的二叉树实际与二叉排序树相反。原创 2017-05-18 17:50:06 · 327 阅读 · 0 评论