Can anybody tell me what is the space and time complexity of this solution

It is finding the kth smallest element in BST

void kthSmallestUtil(Node* root, int k,int &count, int &ans)

{

```
if(root == NULL || count >= k){
return;
}
kthSmallestUtil(root->left, k, count, ans);
count++;
if(count == k){
ans = root->data;
return;
}
kthSmallestUtil(root->right, k, count, ans);
```

}

int KthSmallestElement(Node* root, int k){

```
int count = 0;
int ans = -1;
kthSmallestUtil(root, k, count, ans);
return ans;
```

}