###### leetcode - Convert Sorted List to Binary Search Tree

Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.

/**
* struct ListNode {
*     int val;
*     ListNode *next;
*     ListNode(int x) : val(x), next(NULL) {}
* };
*/
/**
* Definition for a binary tree node.
* struct TreeNode {
*     int val;
*     TreeNode *left;
*     TreeNode *right;
*     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
return nullptr;
int len=0;
while(cur)
{
++len;
cur=cur->next;
}
}
{
if(begin>end)
return nullptr;
if(begin==end)
{
return root;
}
int mid=begin+(end-begin)/2;
root->left=leftchild;
return root;
}

};

#### Convert Sorted List to Binary Search Tree -- LeetCode

2014-04-17 07:57:02

#### LeetCode --- 109. Convert Sorted List to Binary Search Tree

2015-04-17 16:48:22

#### LeetCode Convert Sorted List to Binary Search Tree 解题报告

2014-10-01 22:30:08

#### LeetCode(109)Convert Sorted List to Binary Search Tree

2014-01-19 10:53:55

#### 【LeetCode-面试算法经典-Java实现】【109-Convert Sorted List to Binary Search Tree（排序链表转换成二叉排序树）】

2015-08-10 07:46:41

#### 【Leetcode】【python】Convert Sorted List to Binary Search Tree

2017-07-27 06:30:48

#### Convert Sorted Array to Binary Search Tree -- LeetCode

2014-04-17 07:56:34

#### LeetCode(108)Convert Sorted Array to Binary Search Tree

2014-01-18 02:17:01

#### LeetCode OJ 108. Convert Sorted Array to Binary Search Tree DFS求解

2016-02-25 19:35:34

#### LeetCode题解：Convert Sorted Array to Binary Search Tree

2013-11-10 05:26:40

## 不良信息举报

leetcode - Convert Sorted List to Binary Search Tree