How did tree change

in replace function you didn’t pass root by reference but instead you simply used pointer, then how the changes you made in function reflected in actual root

@ashutosh23bhardwaj hey ,if you return something than there is no need to take pass by reference as copy will be created in function and after function is over yiu return that copy andin main you get that in another root pointer so there is no need for reference but also you can take it.

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.