void DRL(struct tree * root) { if(!root) return; printf("%d ",root->data); DRL(root->right); DRL(root->left); }
nodet* insert( nodet *p,int value) { int balance; if (p==NULL) return createNode(value); if (p->data>value) p->left=insert(p->left,value); else p->right=insert(p->right,value); p->height=max(height(p->left),height(p->right))+1; balance=balaced(p); if (balance>1 && p->left->data>value) return SRR(p); if (balance<-1 && p->right->data<value) return SRL(p); if (balance>1 && p->left->data<value) return DRR(p); if (balance<-1 && p->right->data>value) return DRL(p); else return p; }