@debrata : bt remember its a recursive function...once the leaf node gets
deleted thn it will move bak to the node and thn to the left of it
fr eg
a
/ \
b c
/ \ / \
d e f g
frst g will be deleted...then f thn it wil delete c and so on...i think the
ans shud be 1...correct me if i am wrong...
On Mon, Aug 8, 2011 at 10:49 PM, Debabrata Das <
[email protected]> wrote:
> check this condition
> if( node->left == NULL && node->right == NULL )
> it is true only for leaves node
>
> On Mon, Aug 8, 2011 at 10:46 PM, rajul jain <[email protected]>
> wrote:
> > I have also made same answer on first look but read 3rd option correctly
> it
> > say deletion of leaves from right to left not internal nodes.
> >
> > On Mon, Aug 8, 2011 at 10:36 PM, Debabrata Das
> > <[email protected]> wrote:
> >>
> >> i think 3
> >>
> >> On Mon, Aug 8, 2011 at 10:32 PM, rajul jain <[email protected]>
> >> wrote:
> >> > got it thanks
> >> >
> >> > On Mon, Aug 8, 2011 at 10:30 PM, Akash Mukherjee <[email protected]>
> >> > wrote:
> >> >>
> >> >> i think its 1 though .......
> >> >>
> >> >> On Mon, Aug 8, 2011 at 10:21 PM, rohit <[email protected]>
> wrote:
> >> >>>
> >> >>> What will the following code snippet do, when is it passed the root
> of
> >> >>> a binary tree ?
> >> >>> func( Node *node){
> >> >>>
> >> >>> if(node->right != NULL)
> >> >>>
> >> >>> func( node->right);
> >> >>>
> >> >>> if(node->left != NULL)
> >> >>>
> >> >>> func( node->left);
> >> >>>
> >> >>> if( node->left == NULL && node->right == NULL )
> >> >>>
> >> >>> delete(node);
> >> >>>
> >> >>> }
> >> >>>
> >> >>> Pick choice
> >> >>> Delete the tree from bottom to top
> >> >>>
> >> >>> Delete the tree from top to bottom
> >> >>>
> >> >>> Delete the leaf nodes from right to left
> >> >>>
> >> >>> Delete the leaf nodes from left to right
> >> >>>
> >> >>> I think it is 3
> >> >>>
> >> >>> --
> >> >>> You received this message because you are subscribed to the Google
> >> >>> Groups
> >> >>> "Algorithm Geeks" group.
> >> >>> To post to this group, send email to [email protected].
> >> >>> To unsubscribe from this group, send email to
> >> >>> [email protected].
> >> >>> For more options, visit this group at
> >> >>> http://groups.google.com/group/algogeeks?hl=en.
> >> >>>
> >> >>
> >> >> --
> >> >> You received this message because you are subscribed to the Google
> >> >> Groups
> >> >> "Algorithm Geeks" group.
> >> >> To post to this group, send email to [email protected].
> >> >> To unsubscribe from this group, send email to
> >> >> [email protected].
> >> >> For more options, visit this group at
> >> >> http://groups.google.com/group/algogeeks?hl=en.
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups
> >> > "Algorithm Geeks" group.
> >> > To post to this group, send email to [email protected].
> >> > To unsubscribe from this group, send email to
> >> > [email protected].
> >> > For more options, visit this group at
> >> > http://groups.google.com/group/algogeeks?hl=en.
> >> >
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected].
> >> For more options, visit this group at
> >> http://groups.google.com/group/algogeeks?hl=en.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.