@Ankur : didnt understand , how you want to represent n-ary using this structure.
struct node{ int data; node* left; node* sibling; } if root has 5 children then how will root point to its children using 2 pointers( left ,sibiling) On Wed, Dec 21, 2011 at 3:13 PM, Ankur Garg <ankurga...@gmail.com> wrote: > A better representation for a n-ary tree would be > > struct node{ > int data; > node* left; > node* sibling; > } > > Like in a binary tree the second ptr points to its right child . Here it > points to its sibling.This one saves space and also We know in each level > we have how many nodes > @Shashank, > I think we can reverse the n-ary tree ,but again my doubt is what will be > leaf nodes then in that case , It seems it will be original root , so i was > confused . anyway , I will concentrate on reversing the tree only for now > based on ur definition. > > Regards > Ankur > > > On Wed, Dec 21, 2011 at 1:08 PM, WgpShashank > <shashank7andr...@gmail.com>wrote: > >> @atul,, yeah , but can you write some proper psuedo code/ Algorithm then >> we can discus more about test cases. >> >> Thanks >> Shashank >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/VPZpHM8D_WcJ. >> >> 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. >> > > -- > 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. > -- 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.