摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 解题思路: 1. 找到数组的中间节点将其置为根节点 2. 左边的即为左子树 3. 右边的即为右子树 4. 阅读全文
posted @ 2017-03-18 11:20 小丑进场 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree, write a function kthSmallest to find thekth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's 阅读全文
posted @ 2017-03-18 10:39 小丑进场 阅读(148) 评论(0) 推荐(0) 编辑