you can put two traversals of three (inorder, preorder or postorder) in the file.. Two traversals are enough to dedicate a particular tree.
On Sep 24, 4:05 pm, Asit Dhal <lipu...@gmail.com> wrote: > I need to print a binary search tree in file. When I will retrieve the same > tree from the file. > > I have thought about printing in xml format like this > > 100 > / \ > 50 150 > / \ / \ > 30 70 120 200 > > <Level 0> > 100 > <Level 1> > 50 > <Level 2> > 30 > </Level2> > <Level 2> > 70 > </Level 2> > </Level 1> > <Level 1> > 150 > <Level 2> > 120 > </Level 2> > <Level 2> > 200 > </level 2> > </level 1> > </level 0> > > I don't know will this be the best solution or not. > > Please suggest me how to approach it or some better solution. > > Regards > Asithttp://kodeyard.blogspot.com/ -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.