Here's my sample code for my intro to trees in Python and Java.
Click below to download:
tree.py
TestTrees.java