BST to sorted linked list


It is necessary to put the else block at the end if we are using only if statement
please checkout flattenbst function
Is we see like each node as the left and right pointer instead of using head and tail we can connect the left and the right point

@Vikaspal hey I dont get your doubt please elaborate.

@rishabhmahajan546 actually in this question we returing the head and tail pointer right. I am saying that instead of that why we can utilize the left and right part of a node to store the address
suppose we have BST like
10
9
now we have to make a sorted link list
10 is root we call on the left
node * left = BST(root->left)
left->right = root;
return root;
It is like that se no need of head, tails . Hope u got me point check my ide thread

@Vikaspal yes you can do that also,I got your point.

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.