trees: cleanup depth first search
trees: cleanup breadth first search