Created
November 18, 2014 10:48
-
-
Save shemul/a821222a32acc267b6bb to your computer and use it in GitHub Desktop.
main BST
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "func.h" | |
using namespace std; | |
Tleaf main_root = NULL; | |
int main() | |
{ | |
int x ; | |
for (int i = 0 ; i <3 ; i++) | |
{ | |
cin >> x ; | |
main_root = makeThetree(main_root,x); | |
} | |
cout << "Preview in Inorder: " << endl; | |
inOrder(main_root); | |
cout << endl; | |
cout << "Preview in POSTORDER: " << endl; | |
postOrder(main_root); | |
cout << endl; | |
cout << "Preview in PREORDER: " << endl; | |
preOrder(main_root); | |
cout << endl<< endl; | |
DrawTheTree(main_root); | |
cout << endl <<endl ; | |
cout << "Search !"; | |
cin >> x; | |
/* if ( searchInTree(main_root,x) == NULL) | |
{ | |
cout << "NOT FOUND.." <<endl; | |
cout << "Adding the value in the Tree" <<endl ; | |
makeThetree(main_root,x); | |
cout << "New Iteam Added ! Preview : " <<endl ; | |
inOrder(main_root); | |
} else { | |
cout << "FOUND" ; | |
}*/ | |
searchInTree(main_root,x); | |
if(searchInTree(main_root,x)==1) | |
{ | |
cout << "Adding the value in the Tree" <<endl ; | |
makeThetree(main_root,x); | |
cout << "New Iteam Added ! Preview : " <<endl ; | |
inOrder(main_root); | |
cout << endl << endl ; | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment