Hello! Finally, I am free from the shackles of university. I have all the time in the world to work on some side projects. Lately, I have been trying to learn whatever stuff I am interested in. I've been planning on going over some concepts in computer science that just went past me during my 4 year journey.

One of which are Binary Search Trees.

A Binary Search Tree stores data in a manner that is like a tree, hence the name. Each data in the tree is called a node. A node can only have two decendants, one on the left and one on the right.

It pretty much looks like this. (Thanks, Wikipedia!)

Data in the tree is already sorted. It is because of its simple but effective rules on how data goes into the tree.

- All nodes of left subtree are less than root node
- All nodes of right subtree are more than root node

The root node (the 8 in the picture above!) has descendants that are also Binary Search Trees, which mean that the two rules also apply to them.

Another thing to note is that if a node does not have any descendant, it's called a leaf node.

Read more about it here.

On to my implementation then. I tried to make it as simple and clean as I could. Copy paste it to your editor of choice and run it through Python 3.