Update BFS.cpp

Fixed issue #179
This commit is contained in:
Ashwek Swamy 2019-02-17 17:58:40 +05:30 committed by GitHub
parent 8f468a9cd4
commit f77fd6fb2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ void graph::printgraph(){
} }
void graph::bfs(int s){ void graph::bfs(int s){
bool *visited = new bool[this->v+1]; bool *visited = new bool[this->v+1];
memset(visited,false,sizeof(visited)); memset(visited,false,sizeof(bool)*(this->v+1));
visited[s]=true; visited[s]=true;
list<int> q; list<int> q;
q.push_back(s); q.push_back(s);