Binary Search tree to LL

The output of linked list is coming as only 1–>3
when i give input as 5 3 7 1 6 8 -1 plz explain

@aryamaan1011 hey dont take separate case for left and right or leaf node,after base case call rec to left and right ,after that attach root in midddle of both ,here you have to check for NULL cases ,not in recursion,.try this logic please.

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.