some tree algorithm