Data Structures and Algorithms (English) - 6-14 Count Connected Components(20 分)

简介: Data Structures and Algorithms (English) - 6-14 Count Connected Components(20 分)

题目链接:点击打开链接

题目大意:略。

解题思路:略。

AC 代码

intvis[MaxVertexNum];
voiddfs(LGraphGraph, intv)
{
vis[v]=1;
PtrToAdjVNodep=Graph->G[v].FirstEdge;
while(p)
    {
inti=p->AdjV;
if(!vis[i]) dfs(Graph,i);
p=p->Next;
    }
}
intCountConnectedComponents( LGraphGraph )
{
intcnt=0;
for(inti=0;i<Graph->Nv;i++) vis[i]=0;
for(inti=0;i<Graph->Nv;i++)
if(!vis[i])
        {
dfs(Graph,i);
cnt++;
        }
returncnt;
}
目录
相关文章
|
机器学习/深度学习 数据采集 存储
Doc2EDAG: An End-to-End Document-level Framework for Chinese Financial Event Extraction论文解读
大多数现有的事件抽取(EE)方法只提取句子范围内的事件论元。然而,此类句子级事件抽取方法难以处理来自新兴应用程序(如金融、立法、卫生等)的大量文件
113 0
|
存储 容器
Data Structures and Algorithms (English) - 7-18 Hashing - Hard Version(30 分)
Data Structures and Algorithms (English) - 7-18 Hashing - Hard Version(30 分)
222 0
Data Structures and Algorithms (English) - 7-18 Hashing - Hard Version(30 分)
|
机器学习/深度学习 算法
Data Structures and Algorithms (English) - 7-28 Review of Programming Contest Rules(30 分)
Data Structures and Algorithms (English) - 7-28 Review of Programming Contest Rules(30 分)
216 0
Data Structures and Algorithms (English) - 7-28 Review of Programming Contest Rules(30 分)
Data Structures and Algorithms (English) - 7-12 How Long Does It Take(25 分)
Data Structures and Algorithms (English) - 7-12 How Long Does It Take(25 分)
116 0
Data Structures and Algorithms (English) - 7-8 File Transfer(25 分)
Data Structures and Algorithms (English) - 7-8 File Transfer(25 分)
111 0
Data Structures and Algorithms (English) - 6-6 Level-order Traversal(25 分)
Data Structures and Algorithms (English) - 6-6 Level-order Traversal(25 分)
106 0
Data Structures and Algorithms (English) - 6-2 Two Stacks In One Array(20 分)
Data Structures and Algorithms (English) - 6-2 Two Stacks In One Array(20 分)
145 0
Data Structures and Algorithms (English) - 6-15 Iterative Mergesort(25 分)
Data Structures and Algorithms (English) - 6-15 Iterative Mergesort(25 分)
193 0
Data Structures and Algorithms (English) - 6-8 Percolate Up and Down(20 分)
Data Structures and Algorithms (English) - 6-8 Percolate Up and Down(20 分)
105 0
Data Structures and Algorithms (English) - 6-13 Topological Sort(25 分)
Data Structures and Algorithms (English) - 6-13 Topological Sort(25 分)
112 0