Add simple tree taversal algorithm