Do a simple BFS traversal of the tree. The first node which does not have two childs is where you want to insert the new node. If it has no childs then the new node is the left child. If it has 1 child then the new node is the right child.
-Dhyanesh On 5/8/06, shishir <[EMAIL PROTECTED]> wrote: > > Hi, > I am looking for a method for left to right insertion in a binary tree( > mind it, its not BST am talking about). A simple binary tree where > every root has not more than two childs and the insertion is always > done starting from the leftmost side of any given node. > > 13 > / \ > 27 54 > / \ / \ > 23 42 > > For eg in the above case the next node should be inserted as the left > most child of 54. > Let me know if there's any doubt regarding the question. > > ~Shishir > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---