diff --git a/trees/bst_search.py b/trees/bst_search.py new file mode 100644 index 0000000..05e03c6 --- /dev/null +++ b/trees/bst_search.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# author: bt3gl + +def search_bst(root, val): + + if root is None or root.val == val: + return root + + if val > root.val: + return search_bst(root.right, val) + + else: + return search_bst(root.left, val) +