algorithm for problems in artificial intelligence