Skip to content

Commit f77fd6f

Browse files
authored
Update BFS.cpp
Fixed issue #179
1 parent 8f468a9 commit f77fd6f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Graph/BFS.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void graph::printgraph(){
3030
}
3131
void graph::bfs(int s){
3232
bool *visited = new bool[this->v+1];
33-
memset(visited,false,sizeof(visited));
33+
memset(visited,false,sizeof(bool)*(this->v+1));
3434
visited[s]=true;
3535
list<int> q;
3636
q.push_back(s);
@@ -57,4 +57,4 @@ int main(){
5757
//g.printgraph();
5858
g.bfs(2);
5959
return 0;
60-
}
60+
}

0 commit comments

Comments
 (0)