added simple tree algorithms