标签:style blog http color java strong art ar
题目:
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
题解:
之前做过一道是从sorted array转换到BinarySearchTree的,方法还是一样二分法。但是构造树的方法不是由顶至下了,是要由低至上的建立。
代码如下:
Reference: http://www.programcreek.com/2013/01/leetcode-convert-sorted-list-to-binary-search-tree-java/
Convert Sorted List to Binary Search Tree leetcode java,布布扣,bubuko.com
Convert Sorted List to Binary Search Tree leetcode java
标签:style blog http color java strong art ar
原文地址:http://www.cnblogs.com/springfor/p/3884031.html