Implement TreeIterator

Implement TreeIterator. Also fix one bug in BinaryTree. Add some test
code.