we have to traverse in zig zaz or spirally. so we need two stack or two queus.
On Mon, Dec 12, 2011 at 12:23 AM, atul anand <atul.87fri...@gmail.com>wrote: > @Gene : if i am not wrong , level order traversal can be done using only 1 > queue....why 2 queue??? > > > On Sun, Dec 11, 2011 at 9:53 PM, AMAN AGARWAL <mnnit.a...@gmail.com>wrote: > >> Hi, >> >> Suppose we have a binary search tree as 15,12,18,17,21,11,14 >> then O/P will be 15 12 18 21 17 14 11. >> so the successor of 15 is 12 the successor of 12 is 18 and so on. >> >> I hope now its clear. >> >> >> Regards, >> Aman. >> >> >> On Sun, Dec 11, 2011 at 6:26 PM, WgpShashank >> <shashank7andr...@gmail.com>wrote: >> >>> @atul zig-zag mean spiral traversal of tree e.g. alternate the level >>> while traversing , if previous traversal is left to right , then next level >>> will be right to left . >>> >>> @aman .quest has little ambiguity its says successor but ebvery nodes >>> can have we can ore-order , inorder ,postorder successor isn't it ?? but i >>> am assuming u r interesting in pre-order succesor so then 1st find the >>> per-order successor of each node & then set it , finally traverse it ? >>> >>> correct me if i am wrong ? >>> >>> Thanks >>> Shashank Mani >>> Computer Science >>> BIT Mesra >>> >>> -- >>> 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/-/b51VObaoMZIJ. >>> >>> 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. >>> >> >> >> >> -- >> AMAN AGARWAL >> "Success is not final, Failure is not fatal: It is the courage to >> continue that counts!" >> >> -- >> 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. > -- * Regards* *"The Coder"* *"Life is a Game. The more u play, the more u win, the more u win , the more successfully u play"* -- 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.