tree algorithm related