Folders and files Name Name Last commit message
Last commit date
parent directory
View all files
Differ from a regular Binary Tree because of one key property: Nodes must be arranged in order
the node's left subtree must have values less than the node
the node's right subtree must have values greater than the node
this is going based on that every value in the BST must be unique
Init
tree = BST(1,None,None) creates a tree with one node
A basic constructor that creates a BST with three parameters
BST(value,left_subtree,right_subtree)
Add
tree.add(4) adds 4 to our previous tree created, giving a right child
Maintains BST properties by adding to either subtree depending on the value
returns a string telling if insertion was or wasn't successful
Remove
tree.remove(1) removes 1 from our current tree, resulting 4 to be the sole node
Maintains BST properties by restructuring the tree when we remove the value
returns a string telling if deletion was or wasn't successful
Tomas Urdinola
You can’t perform that action at this time.