main() { struct BST *rt=NULL; rt=insert(rt,5); insert(rt,64); insert(rt,23); insert(rt,2); insert(rt,3); insert(rt,4); int i=0; printf("INPUT\tFLOOR\tCEIL\n"); for(i=0;i<=34;i++) { int c=Ceil(rt,i); int f=Floor(rt,i); printf(" [%d]\t[%d]\t[%d]\n",i,f,c); } printf("\nInoredr:\n"); printinorder(rt); int sum=0; addsum(rt,&sum); printf("\nInoredr:\n"); printinorder(rt); printf("\n"); }
void printinorder(node r) { if(r==NULL) return; printinorder(r->left); printf("%d\t",r->data); printinorder(r->right); }
void printinorder(struct tnode *p) { if (p != NULL) { printinorder(p->left); printf("%d ", p->value); printinorder(p->right); } }
void printinorder(struct BT *root) { if(!root) return; printinorder(root->l); printf("[%d]->",root->data); printinorder(root->r); }
void printinorder(struct node* node) { if(node==NULL) return; else { printinorder(node->left); printf("%d\t",node->data); printinorder(node->right); } }
int main() { struct node *root = newNode(1); root->left = newNode(2); root->right = newNode(3); root->left->left = newNode(4); root->left->right = newNode(5); printinorder(root); doubletree(root); printf("\n"); printinorder(root); return 0; }
void printinorder(struct BST *root) { if(root) { printf("[%d]\t",root->data); printinorder(root->l); printinorder(root->r); } }
int main() { struct BT *root = newnode(6); root->l = newnode(10); root->r = newnode(2); root->l->l = newnode(1); root->l -> r = newnode(3); root->r->r = newnode(12); root->r -> l =newnode(7); printf(" BST Before correction :: \n"); printinorder(root); correctBST(root); printf(" BST after correction :: \n"); printinorder(root); }
int main () { struct tnode *root; root = addtree(NULL, 5); root = addtree(root, 3); root = addtree(root, 7); root = addtree(root, 1); root = addtree(root, 4); printf("Height = %d\n", height(root)); printinorder(root); }
void printinorder(node* nod){ if(nod == NULL)return; printinorder(nod->right); printf("%d", nod->data); printinorder(nod->left); }