mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-07 04:25:34 +08:00
@@ -30,7 +30,7 @@ void graph::printgraph(){
|
||||
}
|
||||
void graph::bfs(int s){
|
||||
bool *visited = new bool[this->v+1];
|
||||
memset(visited,false,sizeof(visited));
|
||||
memset(visited,false,sizeof(bool)*(this->v+1));
|
||||
visited[s]=true;
|
||||
list<int> q;
|
||||
q.push_back(s);
|
||||
@@ -57,4 +57,4 @@ int main(){
|
||||
//g.printgraph();
|
||||
g.bfs(2);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user