int main() { FILE* file; bTreeNode* root; if( ((file = fopen("bTree.txt", "w+")) != NULL) ){ puts("The file could not be opened!"); return 9; } root = createEmptyTree(file); return 0; }
int main() { int i, option; Tree* BinarySearchTree = createEmptyTree(); TreeAVL* AVLTree = createEmptyAVLTree(); printf("Count and plot data\nBinary Search Tree vs. AVL Tree\n\n"); printf("To continue, type 1\nTo exit, type ant other key\n\n"); printf("Your option: "); scanf("%d", &option); if(option == 1) { for(i = 0; i < 10000; i++) { BinarySearchTree = insertNode(BinarySearchTree, i); AVLTree = insertNodeAVL(AVLTree, i); } printf("\nNumber of comparisons to find %d in the AVL Tree: %d\n", i - 1, binarySearchAVL(AVLTree, i - 1, 0)); printf("Number of comparisons to find %d in the Binary Search Tree: %d\n", i - 1, binarySearch(BinarySearchTree, i - 1, 0)); } return 0; }