深搜:对每个可能的路径深入到不能够再深入为止。
程序框架
bool Dfs(v){
if(v为终点)
return true;
if(v为旧点)
return false;
将v标记为旧点;
对和v相邻的每个结点U{
if(Dfs(U) == true)
return true;
}
return false;
}
深搜:对每个可能的路径深入到不能够再深入为止。
程序框架
bool Dfs(v){
if(v为终点)
return true;
if(v为旧点)
return false;
将v标记为旧点;
对和v相邻的每个结点U{
if(Dfs(U) == true)
return true;
}
return false;
}