Binary Search Tree — Insert and Search

Implement a BinarySearchTree class from scratch: insert(value) (preserving the BST property) and search(value) (returning True/False).

Read the number of values to insert, then that many integers (inserted in the order given). Then read the number of queries, then that many integers, printing "Found" or "Not found" for each.

main.py
Loading editor…

Console

Run your code to see output here.