摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 本质就是寻找分割点,分割点作为当前节点,然后递归左区间和右区间。 分割点就是数组中间位置的节点。 那么为 阅读全文
posted @ 2017-10-30 10:17 乐乐章 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2017-10-30 09:41 乐乐章 阅读(195) 评论(0) 推荐(0) 编辑