have a sibling link in every node if you dont want to use a queue. But anyways it will also need space (memory) . Any algorithm for levelwise printing will require extra memory.
On 1/30/08, DanielJohnson <[EMAIL PROTECTED]> wrote: > > > I was trying to solve this problem where we have a binary tree given > and we have to print the values of the tree level by level i.e. root > node then its left child, right child, then left child's both left and > right, then right child's both left and right. > > Since for very large tree using BFS can be memory intensive, so our > restriction is not to use any queue data structure to perform BFS. > > I have thought of using inorder traversal with modified algorithm but > I just figured that out that it fails in certain cases. > > Can anybody suggest an algorithm for this problem ? > > > -- Ciao, Ajinkya --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---