Re: [algogeeks] BST to Double Linked List Without Using Extra Space

2010-11-25 Thread mo...@ismu
On Thu, Nov 25, 2010 at 11:05 PM, mo...@ismu wrote: > > node *bst_to_dl(root) > { > node *head1=NULL,head2=NULL,*temp=NULL; > temp=(node *)calloc(1,sizeof(node)); > temp->value=root->value; > if(root-left) > head1=bst_to_dl(root-left); > if (root->right) > head2=bst_to_dl(root

Re: [algogeeks] BST to Double Linked List Without Using Extra Space

2010-11-25 Thread mo...@ismu
node *bst_to_dl(root) { node *head1=NULL,head2=NULL,*temp=NULL; temp=(node *)calloc(1,sizeof(node)); temp->value=root->value; if(bst-left) head1=bst_to_dl(root-left); if (bst->right) head2=bst_to_dl(root->right); if(head2&&head1)//root having two children { head1->next=h

Re: [algogeeks] BST to Double Linked List Without Using Extra Space

2010-11-24 Thread vaibhav agrawal
If BST is stored in an array, which is already in level order, then there is nothing much remaining to do. On Wed, Nov 24, 2010 at 9:05 PM, vamsee marpu wrote: > Hi, > > > Can anybody help me in solving the following problem: > > > Convert a binary search tree in to a doubly linked list in level