Does anyone know why i keep receiving Output Limit Exceeded with this code?

```
class Solution {
public:
void makeBST(TreeNode *&root, vector<int> &num, int left, int right){
if(left > right){
root = NULL;
return ;
}
if(left == right){
root = new TreeNode(num[left]);
return;
}
int mid = left + (right-left)/2;
root = new TreeNode(num[mid]);
makeBST(root->left, num, left, mid);
makeBST(root->right, num, mid+1, right);
}
TreeNode *sortedArrayToBST(vector<int> &num) {
TreeNode *root;
if(!num.size()) return NULL;
makeBST(root, num, 0, num.size()-1);
return root;
}
};
```