is my approach correct or any optimisations possible?
Tree left view question
Sanchit, the approach you are using in your code is not correct, since the output is coming out to be different from what is required actually, you can basically use the following lines of code,
if(*max_level<level)
{
cout<data<<" ";
*max_level=level;
}
rightutil(root->right,level+1,max_level);
rightutil(root->left,level+1,max_level);
Plz try to follow as per the above approach to get correct result.
my approch was correct and i have asked if that is the best way to do that or not