function TREE-SEARCH(problem, strategy) returns a solution or failture initialize the search tree using the initial state of the problem loop do if there is no candidate for expansion then return failture choose a leaf node for expansion according to strategy if the node contains a goal state then return the corresponding solution else expand the node and add the resulting nodes to the search treeend