摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST.思路:递归的思路。思路与重建二叉树类似。时间复杂度O(n), 空间复杂度O(logN) 1 /** 2 ... 阅读全文
posted @ 2015-01-20 20:14 vincently 阅读(210) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n... 阅读全文
posted @ 2015-01-20 11:44 vincently 阅读(285) 评论(0) 推荐(0) 编辑