迷宫问题的反思

对DFS解决问题的总结。自己总是忘记那些情况函数需要返回,所以特写写个模板:

DFS()
{
  if(找到结束状态) then
   返回 
  end if
  
  if(这个状态越界、不满足这个题意) then 
   返回 
  end if
  
  if(这个状态是访问过了) then
   返回
  end if
  
  DFS();  
}
View Code
原文地址:https://www.cnblogs.com/sundy-lee/p/4692475.html