[LeetCode]108.Convert Sorted Array to Binary Search Tree

【題目】 Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 【分析】 二分法,以中間元素i爲根節點[start,i-1]遞歸構建左子樹,[i+1,end]遞歸構建右子樹 【代碼】 /********************************* *
相關文章
相關標籤/搜索