二叉搜索树题型归纳
二叉搜索树(题型总结)
以下是比较常见的题型,加粗的便是比较常考的了
BST基本操作
- 验证BST 098 Validate Binary Search Tree
- 将排序数组转化为BST 108 Convert Sorted Array to Binary Search Tree
- 将排序链表转化为BST 109 Convert Sorted List to Binary Search Tree
- BST转变为更大的树 [538 Convert BST to Greater Tree]
- 修复BST [099 Recover Binary Search Tree]
- 修剪BST [669 Trim a Binary Search Tree]
- 可构成BST个数-1 096 Unique Binary Search Trees
- 可构成BST个数-2 095 Unique Binary Search Trees II
- 删除节点 450 Delete Node in a BST
- BST的众数 501 Find Mode in Binary Search Tree
- BST最近公共祖先 235 Lowest Common Ancestor of a Binary Search Tree
- BST节点间最小绝对差 530 Minimum Absolute Difference in BST
- BST前K个最小数 230 Kth Smallest Element in a BST
- BST迭代器 [Binary Search Tree Iterator]
BST应用
这些都比较难了。。
- 包含重复值-3 [220 Contains Duplicate III]
- 计算后面较小数字的个数 [315 Count of Smaller Numbers After Self]
- 连续和在指定区间内 [327 Count of Range Sum]
- 分离区间的数据流 [352 Data Stream as Disjoint Intervals]
- 我的日历-2 [731 My Calendar II]
- 我的日历-3 [732 My Calendar III]