Skip to content

Instantly share code, notes, and snippets.

@kartikkukreja
Last active August 29, 2015 14:21
Show Gist options
  • Save kartikkukreja/ba07e7a78cec0b884406 to your computer and use it in GitHub Desktop.
Save kartikkukreja/ba07e7a78cec0b884406 to your computer and use it in GitHub Desktop.
General Tree Search Algorithm
def TreeSearch(problem, strategy):
Initialize search tree using the state state of problem
while True:
if there are no candidates for expansion:
return failure
choose a leaf node for expansion according to strategy
if the node contains a goal state:
return the corresponding solution
else:
expand the node and add its successors to the search tree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment