(+84) 236.3827111 ex. 402

Hàm tìm giá trị bất kỳ trên cây tìm kiếm nhị phân


struct Node
{ int Data;
Node * Left, * Right;
};
typedef Node * BST;
int SEARCH(BST T, int x)
{ if(T==NULL) return 0;
else
if(x==T->Data) return 1;
else
if(xData) return SEARCH(T->Left,x); else return SEARCH(T->Right,x);
}