Learn CS Visual

How a Binary Search Tree Works

A tree links nodes in parent-child relationships. In a binary search tree, the left child is smaller and the right child is larger than the parent. Both insertion and search compare values from the root down, following a path until the value is found or there are no more children.

With the search target set to 7, how many nodes get compared?