sir why i am not getting any output
Largest bst in a binary tree
@YASHMATHURIA123 hey you are printing incorrectly,take the apir object and call function so that pair is returned by function and then print the required thins,hope you get it
no sir can you ellaborate or make changes in my code please
sir can you expalin me why we need to do these equation in a code
ans.leftmax = max(left.leftmax, root->data);
ans.rightmin = min(right.rightmin, root->data);
because without it if it is a bst then we can simply write
that ans.leftmax=left.leftmax;
ans.rightmin=right.rightmin;
because it is a bst then min is on left of root and maximum is on right of root node
@YASHMATHURIA123 hey hme us current node ke left me se and including current node me se minimum dhundhna hai similiarly for right thats why we are taking max of both in left and right.I suggest you to dry run this code ,you will get it.