91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

這是包含所有數據結構四次實驗的源碼,在大家不會的時候可以給大家參考,但是不希望大家去抄襲,態度決定高度!

資源截圖

代碼片段和文件信息

#include“mgraph.h“
#include
template
class?ExtMGraph:public?MGraph
{
public:
ExtMGraph(int?mSizeconst?T?noedg):MGraph(mSizenoedg){}????????????//調用父類構造函數
void?DFS();
void?BFS();
private:
void?DFS(int?ubool*?visited);
void?BFS(int?ubool*?visited);?
};
template
void?ExtMGraph::DFS()
{
bool?*visited?=?new?bool[n];
for(int?i=0;i visited[i]?=?false;
for(i=0;i if(visited[i]==false)
DFS(ivisited);
delete[]?visited;
}
template
void?ExtMGraph::BFS()
{
bool?*visited?=?new?bool[n];
for(int?i=0;i visited[i]?=?false;
for(i=0;i if(visited[i]==false)
BFS(ivisited);
delete[]?visited;
}
template
void?ExtMGraph::DFS(int?ubool*?visited)
{
visited[u]?=?true;
cout< for(int?i=0;i {
if(a[u][i]!=noEdge&&visited[i]==false)
DFS(ivisited);
}
}
template
void?ExtMGraph::BFS(int?ubool*?visited)
{
queue?q;
visited[u]?=?true;
cout< q.push(u);
while(q.empty()==false)
{
u=q.front();
q.pop();
for(int?i=0;i {
if(a[u][i]!=noEdge&&visited[i]==false)
{
visited[i]?=?true;
cout< q.push(i);
}
}
}
}
int?main()
{
ExtMGraph?extMGraph(8-1);
extMGraph.Insert(071);
extMGraph.Insert(061);
extMGraph.Insert(051);
extMGraph.Insert(741);
extMGraph.Insert(621);
extMGraph.Insert(531);
extMGraph.Insert(341);
extMGraph.Insert(411);


cout<<“DFS()函數輸出結果:“< extMGraph.DFS();
cout<<“\nBFS()函數輸出結果:“< extMGraph.BFS();
cout< return?0;
}

評論

共有 條評論