added the functions for tree algorithm

minor additions