```
ListNode* findMiddleNode(ListNode *head, int length) {
if(length <= 0) return NULL;
int mid = (length+1) / 2;
for(int i = 1; i < mid; ++i) head = head->next;
return head;
}
int getLength(ListNode *head) {
int ans = 0;
while(head) { ans++; head = head->next; }
return ans;
}
TreeNode* createBST(ListNode *head, int length) {
ListNode *pMid = findMiddleNode(head, length);
TreeNode *root = NULL;
if(pMid) {
root = new TreeNode(pMid->val);
root->left = createBST(head, (length-1) >> 1);
root->right = createBST(pMid->next, length / 2);
}
return root;
}
class Solution {
public:
TreeNode *sortedListToBST(ListNode *head) {
return createBST(head, getLength(head));
}
};
```

Thoughts: Every time select the middle list Node to creat current BST Node, the tree will be balanced automatically.