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

2013-11-11 Thread atul anand
@don : i did not get it , what will be data in file? On Mon, Nov 11, 2013 at 10:14 PM, Don wrote: > Save in preorder, tagging each node with two bits indicating if that node > has a left and right subtree. > > Then rebuild like this: > > Tree rebuild() > { >Tree result = readNode(); >Tr

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

2013-11-11 Thread Don
Save in preorder, tagging each node with two bits indicating if that node has a left and right subtree. Then rebuild like this: Tree rebuild() { Tree result = readNode(); Tree->left = hasLeftSubtree ? rebuild() : 0; Tree->right = hasRightSubtree ? rebuild() : 0; return result; } On