@jalaj: Hey this is normal insertion. In your code you've not ensured to maintain the balance after insertion which is the main thing I wanted.
@umesh: Could you provide the code for avl tree insertion On Sat, Jul 3, 2010 at 7:21 PM, UMESH KUMAR <[email protected]>wrote: > > > On Sat, Jul 3, 2010 at 7:07 PM, jalaj jaiswal > <[email protected]>wrote: > >> void insert(node *n,int x){ >> if(n==null) >> return ; >> node *p,*t=n; >> node *temp; >> temp=(node *)malloc(sizeof(node)); >> temp->data=x; >> temp->right=temp->left=null; >> while(t!=null){ >> p=t; >> if(x>t->data) >> t=t->right; >> else >> t=t->left; >> } >> if(x>p->data) >> p->right=temp; >> else >> p->left=temp; >> >> >> } >> >> >> On Sat, Jul 3, 2010 at 4:26 PM, Raj N <[email protected]> wrote: >> >>> Hi, >>> Can someone provide me the code to perform insertion in balanced BST >>> with proper explanation. >>> Thanks !! >>> >>> -- >>> 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. >> > > > > > *BALENCED BST means AVL-Tree i.e difference b/w levels not more than 1* > > so you try to write code for Insertion of AVL 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. > -- 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.
