deletes all nodes in the tree.basically it tarverses in postorder and when it is a leaf it deletes the node
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.
