number the nodes in the tree like this: root=1 left child of root=2 right child of root=3
left child of {left child of root}=4 right child of {left child of root}=5 left child of {right child of root}=6 right child of {right child of root}=7 something similar to how you create a heap out of an array of elements. and then visit each node write out its children to an array where element numbered i is wriiten to array[i]. serialize thw array. while deserializing it follow the steps to create a heap out of an array. serialization takes O(n) time and O(n) space and so does deserialization. On Mon, Jul 5, 2010 at 9:01 AM, harit agarwal <agarwalha...@gmail.com>wrote: > in my approach > a( b,c)-> this implies that nodes within parenthesis are child of a where b > is left child and c is right child > if there is no left child then we can use a(,c) and > if there is no right child then use a(b) and > if there is no child use only a > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Topo. There are days when solitude is a heady wine that intoxicates you with freedom, others when it is a bitter tonic, and still others when it is a poison that makes you beat your head against the wall. ~Colette -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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.