serialize means u hv to store binary tree in an array in contiguous locations ( not like the way we store tree in an array usually where children are at 2i+1 n 2i+2 if parent is at i) such that u can reconstruct tree later easily from the array and u shd get the same tree..
@ harit can u please elaborate approach.. wen r u putting ',' if u r putting wen u visit leaf then it shd b there r after 10 too. m nt getting?? On 3 July 2010 19:42, ashish agarwal <[email protected]> wrote: > We can do 4 type of treversal. > If we do inorder then we will get sorted array .If we do an inorder > traversal then we would get a sorted list which if we convert into a BST > would again become a list and we would loose out on the original structure > of the tree. > > and same will be happen with post order > now remaining preorder and level order. > when we do level order traversal it will require more space as it uses BFS > approach .So to do in o(logn) we do preorder travesal. > > > On Sat, Jul 3, 2010 at 5:46 AM, jalaj jaiswal > <[email protected]>wrote: > >> serialize... is it level order traversal ??? >> give an example...? >> >> >> On Sat, Jul 3, 2010 at 12:36 PM, divya <[email protected]> wrote: >> >>> Design an algorithm and write code to serialize a binary tree. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<algogeeks%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >>> >> >> >> -- >> With Regards, >> Jalaj Jaiswal >> +919026283397 >> B.TECH IT >> IIIT ALLAHABAD >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<algogeeks%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
