Some tree algorithm