50 also don`t have a sibling

in the example 50 also don`t have a sibling so it should also be get printed

except the root node
as you can see in the sample output 50 in not present

what is my mistake in the code

your approach is not correct

you can check out this code

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.