BST
xiao1guaishou
这个作者很懒,什么都没留下…
展开
-
PAT1099 Build A Binary Search Tree (30 分)
题目A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The right...原创 2019-07-28 23:49:12 · 79 阅读 · 0 评论 -
LeetCode 450. 删除二叉搜索树中的节点
题目:给定一个二叉搜索树的根节点 root 和一个值 key,删除二叉搜索树中的 key 对应的节点,并保证二叉搜索树的性质不变。返回二叉搜索树(有可能被更新)的根节点的引用。一般来说,删除节点可分为两个步骤:首先找到需要删除的节点;如果找到了,删除它。说明: 要求算法时间复杂度为 O(h),h 为树的高度。root = [5,3,6,2,4,null,7]key = 3 ...原创 2019-07-29 20:59:40 · 125 阅读 · 0 评论 -
PAT A1043 Is It a Binary Search Tree (25 分)
题目:A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The righ...原创 2019-07-26 19:24:55 · 320 阅读 · 0 评论 -
PAT 1064 Complete Binary Search Tree (30 分)
题目:A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The righ...原创 2019-07-28 00:09:46 · 103 阅读 · 0 评论