int main() { binarySearchTree bst = create_BST(50) ; for(int i = 0 ; i <= 100 ; i+= 10) { if(i != 50) insertValue_BST(bst,i) ; } deleteValue_BST(bst,20) ; for(int i = 0 ; i <= 100 ; i+=10) { binarySearchTree tmp = findValue_BST(bst,i) ; if(i == 20) { if(tmp != NULL) printf("Error %d\n",i); } else if(tmp == NULL) { printf("Error %d\n",i) ; } if(tmp != NULL) free(tmp) ; } destroy_BST(bst) ; return EXIT_SUCCESS ; }
int main (void) { BSTree root; create_BST (&root); BST_print (root); BSTree node = BST_search (root, 5); node ? printf ("find : key = %d\n", node->data.key) : printf ("haven't find!\n"); BST_destroy (&root); return 0; }