Your algorithm is correct. But > 3. Remove the children from this place and store them as BST3 and BST4.
This is not required , because trying to merge BST2 with BST1,which is equivalent to finding a place to insert a pointer to root of BST2 in BST1. Whenever you need a place for a new node, you take a place of a existing leaf in BST1 for that new node. So we need not worry about children. Also in a BST there is no configuration for which a new element can not be inserted. So we can just link the pointers and get a merged tree. -- 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.
