From 5dbf37a9f277e19636f1e740e8befc421c19aa25 Mon Sep 17 00:00:00 2001 From: Aleksandr Mishukhin <100044766+aleksmish@users.noreply.github.com> Date: Wed, 10 Sep 2025 14:31:43 +0300 Subject: [PATCH] fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed from "then ā€Šuā€Š must have been insert in the queue" to "then ā€Šuā€Š must have been inserted into the queue" --- src/graph/01_bfs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graph/01_bfs.md b/src/graph/01_bfs.md index 5d7aee6f4..68a4a01c9 100644 --- a/src/graph/01_bfs.md +++ b/src/graph/01_bfs.md @@ -42,7 +42,7 @@ while (!q.empty()) { We can notice that the difference between the distances between the source `s` and two other vertices in the queue differs by at most one. Especially, we know that $d[v] \le d[u] \le d[v] + 1$ for each $u \in Q$. The reason for this is, that we only add vertices with equal distance or with distance plus one to the queue during each iteration. -Assuming there exists a $u$ in the queue with $d[u] - d[v] > 1$, then $u$ must have been insert in the queue via a different vertex $t$ with $d[t] \ge d[u] - 1 > d[v]$. +Assuming there exists a $u$ in the queue with $d[u] - d[v] > 1$, then $u$ must have been inserted into the queue via a different vertex $t$ with $d[t] \ge d[u] - 1 > d[v]$. However this is impossible, since Dijkstra's algorithm iterates over the vertices in increasing order. This means, that the order of the queue looks like this: