...

/

Solution Review: Search Value in a Binary Tree

Solution Review: Search Value in a Binary Tree

Let’s take a detailed look at the previous challenge’s solution.

We'll cover the following...

Solution

To find if a value exists in a binary tree, we’ll use the exhaustive search algorithm. First, we’ll compare the value in the current node with our key. If it matches, we end our search. If it doesn’t, we’ll recursively look for the key in the left and right subtrees. We’ll stop when we find our desired ...