
Binary Tree Search
I've been looking and looking, but all I can find are searches that are part of classes and I'd rather have something a lot simpler to learn this whole concept from. So, anyway, can someone show me a binary tree search function that searches a simple binary tree given the tree, and a number?
the tree:
struct btree
{
int data;
btree *left;
btree *right;
};
Thanks for all of your help. It will be much appreciated.

In this way you can traverse to a tree in preorder. I guess this helps you on your way for a search function.
Code:
void preorder (struct btree *root)
{
if (root)
{
printf ("%d\n", root>data);
preorder (root>left);
preorder (root>right);
}
}
Extend the function in such a way that it also accepts a variable which contains the value which is searched for. Also add code for comparison and find a way to tell the calling function if the value was found or not and if it was found, find out how to let the calling function know which node contains the value.

search the boards.. there must be 50 topics with this title or something similar.