Re: [algogeeks] Re: Saving and restoring Binary trees in files

2013-11-08 Thread atul anand
@don : it is not BST , it is binary tree ...so your approach will not work in this case. @kumar : save pre-order and in-order traversal with some delimiter in b/w traversals. pre-order : a b c d e in-order : c b e a d write in file :- a b c d e # c b e a d now use pre-order and in-order tr

Re: [algogeeks] Re: Saving and restoring Binary trees in files

2013-11-08 Thread Vishnu
1) save the nodes(value, left and right pointer) in pre-order traversal 2) also save pointers of all node in same order to restore 1) create new N nodes 2) do pointer mapping from old -> new 3) restore nodes and replace old pointers to new On Fri, Nov 8, 2013 at 8:50 PM, Don wrote: > Save it i

[algogeeks] Re: Saving and restoring Binary trees in files

2013-11-08 Thread Don
Save it in pre-order. Rebuild by inserting nodes in the order they occur in the file. On Friday, November 8, 2013 8:33:19 AM UTC-5, kumar raja wrote: > > What is the effective way to save and restore the binary trees to files > effectively? > > > > > > > > > > > > > > Regards, > Kumar Raja. > --

[algogeeks] Saving and restoring Binary trees in files

2013-11-08 Thread kumar raja
What is the effective way to save and restore the binary trees to files effectively? Regards, Kumar Raja. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To unsubscribe from this group and stop receiving emails from it, send an e