vis[i]){ 55 vis[i] = true; RecStack[i] = true; 56 if(isCyclic(edgelist,G,vis,RecStack,i)){ 57 cout<<i<<" starts a cycle"<<endl; 58 } 59 RecStack[i] = false; 60 } 61 } 62 63 return 0; 64 } 分类: 数据结构 好文要顶 关注我 收藏该文 微信分享 流白 粉丝- 22 ...
BFS and DFS - know their computational complexity, their tradeoffs, and how to implement them in real code When asked a question, look for a graph-based solution first, then move on if none. MIT(videos): Breadth-First Search Depth-First Search Skiena Lectures - great intro: CSE373 2012 ...