Δένδρα αναζήτησης

Παράδειγμα αναζήτησης

/*
 * Search for the integer i in the ordered binary tree t
 * If found return its node; otherwise return NULL
 */
struct s_tree
search(struct s_tree *t, int i)
{
	if (t == NULL)
		return (NULL);
	else if (t->val == i)
		return (t);
	else if (i < t->val)
		return (search(t->left, i));
	else
		return (search(t->right, i));
}