Finding Data

Now, we want to find certain data inside the Binary Search Tree.

The general code shown below.

Find (Node current, Data value)
{
    if (current == null)
        return null;

    if (current.Value == value)
        return current;

    if (value < current.Value)
        return Find(current.Left, value);
    else
        return Find(current.Right, value);
}

Find(Root, 3);
Find(Root, 5);
Find(Root, 8);

results matching ""

    No results matching ""