MCS 275 Spring 2022
        Emily Dumas
    
Course bulletins:
I've created a new directory trees in the course sample code repository.
Live coding examples from the next couple of lectures will be added there.
Learn about search and insert operations on binary search trees.
Explore an application to a fast data structure for storing a set of integers.
A binary tree in which:
        
        
        
        
        
        
    
        
        
    This "just" is a binary tree with keys.
        
        
        
        
        
        
        
        
        
    Let's build a class to represent nodes of a binary tree that also store keys.
I provide a module treevis in the sample code repository that can "pretty print" a tree with the function treeprint(root).
Challenge: Read the source of treevis and figure out how it works!
Now let's build a subclass of Node to represent a BST.
Desired features:
Given x, find and return a node with key x.  Return None if no such node exists.
        
        
        
        
        
        
        
        
    Given a key, add a node to the tree with that key, maintaining the BST property.
        
        
        
        
        
    Let's use this to build a class to store a collection of integers that supports fast insertion and membership testing.
IntegerSet has many possible implementations (e.g. a list, a tree, ...), and a user of the class doesn't need to know about which one it uses.