2023年8月15日

摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 int main(){ 4 ios::sync_with_stdio(false); 5 string s1="what about to ask ",s2="Mike telephone numb 阅读全文

posted @ 2023-08-15 22:09 jacyoier 阅读(16) 评论(0) 推荐(0)

摘要: DFS方法1,不适用递归: 1 #include<bits/stdc++.h> 2 using namespace std; 3 int main(){ 4 ios::sync_with_stdio(false); 5 int a[10][10],stk[10],h[10]; 6 int n,top 阅读全文

posted @ 2023-08-15 17:19 jacyoier 阅读(47) 评论(0) 推荐(0)

摘要: 本博客来自转载! 第一部分 深度优先搜索算法(以下简称DFS)是一种用于遍历(或搜索)树(或图)的算法。 我们构造这样一个图(如图1),并通过C++实现DFS 算法过程 1.从根节点开始 2.放入一个节点(起始时放入的为根节点) 3.如果这个节点是第一次出现,则放入堆栈中 4.判断该节点的子节点是否 阅读全文

posted @ 2023-08-15 15:31 jacyoier 阅读(300) 评论(0) 推荐(0)


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3