Re: [algogeeks] Re: Zig Zag tree traversal

2011-08-28 Thread siddharam suresh
bit alteration to the max width problem, thats it nothing else. Thank you, Sid. On Sun, Aug 28, 2011 at 11:07 PM, siddharam suresh wrote: > if its only printing the values then > > > > int get_height(node temp) > { > if(temp!=NULL) > { > > return(get_height(temp->L)>get_height(temp->R)?(get_h

Re: [algogeeks] Re: Zig Zag tree traversal

2011-08-28 Thread siddharam suresh
if its only printing the values then int get_height(node temp) { if(temp!=NULL) { return(get_height(temp->L)>get_height(temp->R)?(get_height(temp->L)+1):(get_height(temp->R)+1)); } return 0; } void get_width(node temp, int level,int direction) { if(temp==NULL) return 0; if(level==1) {pri

Re: [algogeeks] Re: Zig Zag tree traversal

2011-08-28 Thread Kunal Patil
@ Kartikeyan: If you use normal queue implementation how you are going to print reverse??? (From ptr2 to ptr1)...If you are implementing queue in an array, then your solution can be feasible.. If not in array, you must modify your queue DS to include pointers to previous elements. Or you can do th

[algogeeks] Re: Zig Zag tree traversal

2011-08-28 Thread Navneet
Liao, your solution will generate the required manner. However, can you try to do the same by using some bool value and a single stack/ queue? Let bool value decide whether you want to insert right to left or left to right. Haven't tried myself but think that should work. Karthik, never did i ment