DFS中如何一找到true就返回true, 其他返回false

来源:互联网 发布:婚礼电子请柬软件 编辑:程序博客网 时间:2024/06/05 04:57

boolean function(object, currentLocation, Termination){   if (currentLocation satisfies Terminaiton){          return true;   }   for (go through all the nextLocations){      if (unsatisfy condition) return false;      if ( function(object[], ChangedObject, nextCurrentLocation, Termination)) return true;   }   return false; }