August 2017
Intermediate to advanced
222 pages
5h 3m
English
Here again is a binary tree:

The algorithm for searching within a binary tree begins at the root node:
Here’s a simple, recursive implementation for this search in Python:
| | def search(value, node): |
| | # Base case: If the node is nonexistent |
| | # or we've found the value we're looking for: |
| | if node is None or node.value == value: |
| | return node |
| | |
| |