bool search(Node* root, int x) {
if(!root) return false;
if(root->data==x) return true;
if(x>root->data)
return search(root->right,x);
return search(root->left,x);
}
bool search(Node* root, int x) {
while(root!=NULL && root->data!=x)
{
root= x>root->data? root->right : root->left;
}
return root;
}