MCS 275 Spring 2024
Emily Dumas
Reminders and announcements:
Let's add insert to trees.py:
k (that is not present)BST object and make it the appropriate child.I added a module to the datastructures directory of the sample code repository which can
generate random trees. You'll
use it in lab this week.
How would you make purely iterative versions of insert and search?
e.g. a function completely separate from the class called like bst_insert(root,new_key)
As a sample application of BST, we can make a class that stores a set of integers, supporting membership testing and adding new elements.
Compare alternatives:
set - fast everythingTo use BST, you need to know about and work with Node objects.
In contrast, IntegerSet has an interface based directly on the values to be stored. It
hides the fact that its implementation uses a BST.