We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3abfdd7 commit 73b857cCopy full SHA for 73b857c
SourceCodes/0003_Graph/0001_BreadthFirstSearch.cc
@@ -42,7 +42,7 @@ void BFSGraph::BreadthFirstSearch(Node* node)
42
Node* currentNode = nodeQueue.front();
43
nodeQueue.pop();
44
45
- for (auto adjacentNode : this->_adjlist[currentNode])
+ for (auto &adjacentNode : this->_adjlist[currentNode])
46
{
47
if (adjacentNode->color == WHITE)
48
@@ -73,9 +73,9 @@ void BFSGraph::BFS(char value)
73
string BFSGraph::ShowBFSResult()
74
75
string result = "";
76
- for (auto value : this->_nodeMap)
+ for (auto &node : this->_nodeMap)
77
78
- result = result + " " + value.first + "(" + to_string(value.second->distance) + ")";
+ result = result + " " + node.first + "(" + to_string(node.second->distance) + ")";
79
}
80
return result;
81
0 commit comments