Kth smallest tree

What if i am given a simple array.Can i not sort it and use bst?will that be optimum to?

How to convert an array to bst?

@DhrubanilSikdar hey yes this may be one approach but most of cases me you will be given a root of bst and you have to find in that ,also then if you store that in array ,than extra space will be there therefore hm ye wala nhi use krte but it is the first aproach that come in mind and you can tell to interviewer.

@DhrubanilSikdar hey apko linewise array ko traverse krke insert krna pdega us element ko bst ,ade firsty root than apply insert function of bst to 2 then 3 then 4…Hope you get it :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.