摘要: 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 阅读全文
posted @ 2020-05-23 23:33 苗妙苗 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is d 阅读全文
posted @ 2020-05-23 10:21 苗妙苗 阅读(129) 评论(0) 推荐(0) 编辑
摘要: [抄题]: Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You 阅读全文
posted @ 2020-05-23 06:45 苗妙苗 阅读(215) 评论(0) 推荐(0) 编辑
摘要: [抄题]: Invert a binary tree. Example: Input: 4 / \ 2 7 / \ / \ 1 3 6 9 Output: 4 / \ 7 2 / \ / \ 9 6 3 1 复习时还不会的地方:没啥了,就加个null的判断条件就行了 [暴力解法]: 时间分析: 空间 阅读全文
posted @ 2020-05-23 04:58 苗妙苗 阅读(71) 评论(0) 推荐(0) 编辑