Tuesday, September 30, 2014

Convert Sorted Array to Binary Search Tree

Problem

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.

Idea

就是二分法.找到num的中间元素, 然后二分去build左子树与右子树

Solution


No comments:

Post a Comment