Skip to content

Commit 73b857c

Browse files
committed
minor fix
1 parent 3abfdd7 commit 73b857c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

SourceCodes/0003_Graph/0001_BreadthFirstSearch.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void BFSGraph::BreadthFirstSearch(Node* node)
4242
Node* currentNode = nodeQueue.front();
4343
nodeQueue.pop();
4444

45-
for (auto adjacentNode : this->_adjlist[currentNode])
45+
for (auto &adjacentNode : this->_adjlist[currentNode])
4646
{
4747
if (adjacentNode->color == WHITE)
4848
{
@@ -73,9 +73,9 @@ void BFSGraph::BFS(char value)
7373
string BFSGraph::ShowBFSResult()
7474
{
7575
string result = "";
76-
for (auto value : this->_nodeMap)
76+
for (auto &node : this->_nodeMap)
7777
{
78-
result = result + " " + value.first + "(" + to_string(value.second->distance) + ")";
78+
result = result + " " + node.first + "(" + to_string(node.second->distance) + ")";
7979
}
8080
return result;
8181
}

0 commit comments

Comments
 (0)