摘要: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. (Medium) 分析: 链表不同于数组的是需要先遍历一遍求出长度,然后再找到中 阅读全文
posted @ 2016-11-07 19:30 wangxiaobao1114 阅读(210) 评论(0) 推荐(0) 编辑
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. (Medium) 分析: 因为要构成BBST,所以要从中点开始,左边为左子树,右边为右子树,采用help 阅读全文
posted @ 2016-11-07 19:28 wangxiaobao1114 阅读(155) 评论(0) 推荐(0) 编辑