Skip to content

Commit f28d1a2

Browse files
authored
Merge pull request #1474 from aleksmish/patch-1
fix typo
2 parents 0da3b79 + 77381f8 commit f28d1a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/graph/mst_prim.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void prim() {
147147
```
148148

149149
The adjacency matrix `adj[][]` of size $n \times n$ stores the weights of the edges, and it uses the weight `INF` if there doesn't exist an edge between two vertices.
150-
The algorithm uses two arrays: the flag `selected[]`, which indicates which vertices we already have selected, and the array `min_e[]` which stores the edge with minimal weight to an selected vertex for each not-yet-selected vertex (it stores the weight and the end vertex).
150+
The algorithm uses two arrays: the flag `selected[]`, which indicates which vertices we already have selected, and the array `min_e[]` which stores the edge with minimal weight to a selected vertex for each not-yet-selected vertex (it stores the weight and the end vertex).
151151
The algorithm does $n$ steps, in each iteration the vertex with the smallest edge weight is selected, and the `min_e[]` of all other vertices gets updated.
152152

153153
### Sparse graphs: $O(m \log n)$

0 commit comments

Comments
 (0)