eli5: binary search trees described only with graph theory terminology?

181 views

I understand that a binary search tree is a graph with rules and how it’s used in coding but relaying it in math terms is confusing me

In: 0

3 Answers

Anonymous 0 Comments

Imagine doing a search and picking one item from a group. Let’s say that that item isn’t a match. Because it’s not a match, you now know that half of the items in that group also don’t match (because the group is sorted).

So, you start a search again but on the other half. Pick an item, does it match? If yes, great. If not, you can now eliminate half of the items in *that* group. Since you eliminated half of the group you originally started with and half of the sub-group, you’re now down to 1/4 of the original group.

Each search reduces the possibilities by half, making a binary tree search very efficient.

You are viewing 1 out of 3 answers, click here to view all answers.