please see why not all the testcase is passing
Didn't pass all testcase
3
2 3 1
3
3 2 1
for this type of input where
there are more than one nodes in a level your output is wrong
your output
3 => 2 1
END => 3 <= END END => 1 <= END
i hope you understand your mistake
actually this is not level order traversal it is preorder traversal so print function should look like
void ModifiedPreoder(Node *rot)
{
if(rot==NULL)
return;
if(rot->left)cout<<rot->left->data<<" => "; else cout<<"END => ";
cout<<rot->data<<" => ";
if(rot->right)cout<<rot->right->data<<endl; else cout<<"END\n";
preoder(rot->left);
preoder(rot->right);
}
i hope this help
if you have more doubts regarding this feel free to ask
and if your doubt is resolved please mark it as resolved from your doubt section in your course