My code seems to be correct, I am unable to detect any error. Yet it is printing a wrong answer. Could you please guide me as to where I have made the mistake.
According to me, the problem seems to be in the Pre-Order traversal, but that code seems to be alright to me.
Kindly look through and suggest changes if need be.
Regards,
Ajay Bhat.