Added depth-first-search algorithm to ctree